Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NR-320035- Updating Video-Shaka-Js #10

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"presets": ["env"]
}
"presets": [
"@babel/preset-env"
],
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: ["@babel/preset-env"],
plugins: ["@babel/plugin-transform-modules-commonjs"],
};
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
testEnvironment: "node",
moduleFileExtensions: ["js", "jsx"],
transform: {
"^.+\\.jsx?$": "babel-jest",
},
transformIgnorePatterns: ["node_modules/(?!@shotgunjed)/"],

testMatch: ["**/__tests__/**/*.js?(x)", "**/?(*.)+(spec|test).js?(x)"],
};
12,024 changes: 7,852 additions & 4,172 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
"description": "New relic tracker for shaka player",
"main": "src/index.js",
"scripts": {
"test": "jest --coverage",
"build": "webpack -p",
"build:dev": "webpack --mode development",
"watch": "webpack -p --progress --color --watch",
@@ -20,15 +21,19 @@
"author": "Jordi Aguilar",
"license": "MIT",
"dependencies": {
"codem-isoboxer": "^0.3.10",
"newrelic-video-core": "git+https://github.com/newrelic/video-core-js.git"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@babel/preset-env": "^7.0.0",
"aws-sdk": "^2.920.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-loader": "^8.0.0",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"videojs-ima": "^0.6.0",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
}
}
10 changes: 8 additions & 2 deletions samples/agent.js

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions samples/autoplay.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shaka Player MSS Example</title>
<!-- newrelic browser agent. REMEMBER TO REPLACE THIS SCRIPT WITH YOUR OWN BROWSER AGENT -->
<script type="text/javascript" src="agent.js"></script>

<!-- newrelic tracker -->
<script src="../dist/newrelic-video-shaka.min.js"></script>

<!-- shaka -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.2.1/shaka-player.compiled.debug.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.11.2/shaka-player.compiled.js"></script>
<!-- MSS support only with codem-isoboxer javaScript MP4 (MPEG-4, ISOBMFF) parser -->
<script defer src="../node_modules/codem-isoboxer/dist/iso_boxer.min.js"></script>
</head>
<body>
<video id="myPlayer" width="640" height="480" crossorigin="anonymous" controls autoplay></video>
<video id="myPlayer" width="640" height="480" crossorigin="anonymous" controls autoplay></video>
<script>
function initPlayer() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the functions to separate js file

async function initPlayer() {
// Install polyfills.
shaka.polyfill.installAll()

// Find the video element.
var video = document.getElementById('myPlayer')

// Construct a Player to wrap around it.
var player = new shaka.Player(video)

// Attach the player to the window so that it can be easily debugged.
window.player = player
var player = new shaka.Player(video);

// source
var source = 'https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/master.m3u8'

// newrelic
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player))
var source = 'https://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest';

// Load the source into the Player.
player.load(source).catch(function(error) {
nrvideo.Core.sendError(error)
})
try {
await player.load(source);
// newrelic
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player));
} catch (error) {
nrvideo.Core.sendError(error)
}
}

document.addEventListener('DOMContentLoaded', initPlayer)
</script>
</body>
</html>
</html>
21 changes: 11 additions & 10 deletions samples/dash.html
Original file line number Diff line number Diff line change
@@ -8,12 +8,12 @@
<script src="../dist/newrelic-video-shaka.min.js"></script>

<!-- shaka -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.2.1/shaka-player.compiled.debug.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.11.2/shaka-player.compiled.debug.min.js"></script>
</head>
<body>
<video id="myPlayer" width="640" height="480" crossorigin="anonymous" controls></video>
<script>
function initPlayer() {
async function initPlayer() {
// Install polyfills.
shaka.polyfill.installAll()

@@ -28,14 +28,15 @@

// source
var source = 'https://turtle-tube.appspot.com/t/t2/dash.mpd'

// newrelic
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player))

// Load the source into the Player.
player.load(source).catch(function(error) {
nrvideo.Core.sendError(error)
})

try {
window.player = player;
await player.load(source);
// newrelic
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player));
} catch (error) {
nrvideo.Core.sendError(error)
}
}

document.addEventListener('DOMContentLoaded', initPlayer)
30 changes: 18 additions & 12 deletions samples/hls.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shaka HLS Player</title>
<!-- newrelic browser agent. REMEMBER TO REPLACE THIS SCRIPT WITH YOUR OWN BROWSER AGENT -->
<script type="text/javascript" src="agent.js"></script>

<!-- newrelic tracker -->
<script src="../dist/newrelic-video-shaka.min.js"></script>

<!-- shaka -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.2.1/shaka-player.compiled.debug.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.11.2/shaka-player.compiled.debug.min.js"></script>

</head>
<body>
<video id="myPlayer" width="640" height="480" crossorigin="anonymous" controls></video>
<script>
function initPlayer() {
async function initPlayer() {
// Install polyfills.
shaka.polyfill.installAll()

@@ -24,18 +28,20 @@
var player = new shaka.Player(video)

// Attach the player to the window so that it can be easily debugged.
window.player = player

// source
var source = 'https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/master.m3u8'
// window.player = player

// newrelic
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player))
// // source
var source = 'http://content.jwplatform.com/manifests/vM7nH0Kl.m3u8'

// Load the source into the Player.
player.load(source).catch(function(error) {
nrvideo.Core.sendError(error)
})
// Load the source into the Player.
try {
window.player = player;
await player.load(source);
// newrelic
nrvideo.Core.addTracker(new nrvideo.ShakaTracker(player));
} catch (e) {
nrvideo.Core.sendError(error);
}
}

document.addEventListener('DOMContentLoaded', initPlayer)
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as nrvideo from 'newrelic-video-core'
import Tracker from './tracker'
import * as nrvideo from 'newrelic-video-core';
import Tracker from "./tracker";

nrvideo.ShakaTracker = Tracker

module.exports = nrvideo
module.exports = nrvideo;
Loading