Skip to content

Commit

Permalink
Merge pull request #15 from newrelic/develop
Browse files Browse the repository at this point in the history
Releasing 3.0.0 to stable version
  • Loading branch information
mlychndnnr authored Feb 21, 2025
2 parents f2b6eb0 + 02760a4 commit 88db5d4
Show file tree
Hide file tree
Showing 8 changed files with 368 additions and 55 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## [3.0.0] - 2025/02/21

### New Event Type Introduced [VideoAction, VideoErrorAction, VideoAdAction, VideoCustomAction]

- PageAction Deprecated.
- Some New Attributes Introduced.

## [0.4.0] - 2024/10/07

### Update
Expand Down
225 changes: 225 additions & 0 deletions DATAMODEL.md

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)

# New Relic Shaka Tracker

New Relic video tracking for Shaka Player.

## Requirements

This video monitor solutions works on top of New Relic's **Browser Agent**.

## Build

Install dependencies:

```
$ npm install
```

And build:

```
$ npm run build:dev
```

Or if you need a production build:

```
$ npm run build
```

## Usage

Load **scripts** inside `dist` folder into your page.

```html
<script src="../dist/newrelic-video-Shaka.min.js"></script>
```

```javascript
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player));
```

## Release

- Create a PR.
- Once approved, Update the package version according to the semver rules.
- Update the CHANGELOG in the repo (all web repos have a changelog file).
- Create a github tag with the version.
82 changes: 53 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,75 @@
[![New Relic Experimental header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Experimental.png)](https://opensource.newrelic.com/oss-category/#new-relic-experimental)
[![Community Project header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Project.png)](https://opensource.newrelic.com/oss-category/#community-project)

# New Relic Shaka Tracker
# New Relic Shaka Tracker Agent

New Relic video tracking for Shaka Player.
The New Relic Shaka Tracker enhances your media applications by tracking video events, playback errors, and other activities, providing comprehensive insights into performance and user interactions.

## Requirements
- The Shaka tracker is available as a ready-to-use JavaScript snippet for easy copy-paste integration.
- New Relic Shaka tracker auto-detects events emitted by Shaka Player.
- Ensure that the **Browser agent** is successfully instrumented before deploying the media tracker.
- For questions and feedback on this package, please visit the [Explorer's Hub](https://discuss.newrelic.com), New Relic's community support forum.
- Looking to contribute to the Player Name agent code base? See [DEVELOPING.md](./DEVELOPING.md) for instructions on building and testing the browser agent library, and Contributors.

This video monitor solutions works on top of New Relic's **Browser Agent**.
## Adding The Shaka Tracker To Your Project

## Build
To integrate New Relic Tracker Agent into your web application effectively, you'll need to instrument the Browser Agent code first and then add the player script. Below is a guide on how to do this within your HTML file:

Install dependencies:

```
$ npm install
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>New Relic Tracker Integration</title>
<script src="path/to/browser-agent.js"></script>
<!-- snippet code generated -->
<script src="path/to/Shaka-tracker.js"></script>
</head>
<body>
<!-- Your HTML content -->
</body>
</html>
```

And build:
## Instantiating the Shaka Tracker

```
$ npm run build:dev
```
```javascript
// Add a ShakaTracker
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player));

Or if you need a production build:
// For setting userId
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player)).setUserId('userId');

```
$ npm run build
```
//For setting custom attributes const tracker
const tracker = new nrvideo.ShakajsTracker(player, {
customData: {
contentTitle: 'Override Existing Title',
customPlayerName: 'myGreatPlayer',
customPlayerVersion: '9.4.2',
},
});

## Usage
// For Sending custom Action with Attributes

Load **scripts** inside `dist` folder into your page.
const tracker = new nrvideo.ShakaTracker(player);

```html
<script src="../dist/newrelic-video-shaka.min.js"></script>
```
nrvideo.Core.addTracker(tracker);

```javascript
// var player = new shaka.Player(...)
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player))
tracker.sendCustom('CUSTOM_ACTION', 'state time', {
test1: 'value1',
test2: 'value2',
});
```

## Data Model

To understand which actions and attributes are captured and emitted by the Shaka Player under different event types, see [DataModel.md](./DATAMODEL.md).

## Support

New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub.
New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic [Explorer's Hub](https://discuss.newrelic.com).

We encourage you to bring your experiences and questions to the [Explorers Hub](https://discuss.newrelic.com) where our community members collaborate on solutions and new ideas.
We encourage you to bring your experiences and questions to the [Explorer's Hub](https://discuss.newrelic.com) where our community members collaborate on solutions and new ideas.

## Contributing

Expand All @@ -59,4 +83,4 @@ If you believe you have found a security vulnerability in this project or any of

## License

New Relic Shaka Tracker is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
New Relic Shaka Tracker is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newrelic-video-shaka",
"version": "0.3.0",
"version": "3.0.0",
"description": "New relic tracker for shaka player",
"main": "src/index.js",
"scripts": {
Expand All @@ -22,7 +22,7 @@
"license": "MIT",
"dependencies": {
"codem-isoboxer": "^0.3.10",
"newrelic-video-core": "github:newrelic/video-core-js#develop"
"newrelic-video-core": "github:newrelic/video-core-js#stable"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand Down
2 changes: 0 additions & 2 deletions src/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export default class ShakaTracker extends nrvideo.VideoTracker {
return this.player.getPlaybackRate();
}

getContentPlayhead() {}

getTrack() {
var tracks = this.player.getVariantTracks();
for (var i in tracks) {
Expand Down
45 changes: 28 additions & 17 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
var path = require('path')
var webpack = require('webpack')
var path = require('path');
var webpack = require('webpack');
var TerserPlugin = require('terser-webpack-plugin');

var pkg = require('./package.json')
var license = '@license ' + pkg.license +
'\n' + pkg.name + ' ' + pkg.version +
'\nCopyright New Relic <http://newrelic.com/>' +
'\n@author ' + pkg.author
var pkg = require('./package.json');
var license =
'@license ' +
pkg.license +
'\n' +
pkg.name +
' ' +
pkg.version +
'\nCopyright New Relic <http://newrelic.com/>' +
'\n@author ' +
pkg.author;

module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: pkg.name + '.min.js',
library: 'nrvideo',
libraryTarget: 'umd'
libraryTarget: 'umd',
},
devtool: 'source-map',
module: {
Expand All @@ -23,16 +30,20 @@ module.exports = {
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { targets: "defaults" }]]
}
}
}
]
presets: [['@babel/preset-env', { targets: 'defaults' }]],
},
},
},
],
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
plugins: [
new webpack.BannerPlugin({
banner: license,
entryOnly: true
})
]
}
entryOnly: true,
}),
],
};

0 comments on commit 88db5d4

Please sign in to comment.