Skip to content

Commit

Permalink
Cleanup and fix WebOS setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinber committed Jun 26, 2024
1 parent b4e717c commit 21728fa
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 181 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules
.vscode
**/bitmovin-player-yospace.js
tizen/*.wgt
WebOS/*.ipk
4 changes: 0 additions & 4 deletions WebOS/.gitignore

This file was deleted.

260 changes: 148 additions & 112 deletions WebOS/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
<!DOCTYPE html>
<!--
*
* Copyright (C) 2019, Bitmovin Inc, All Rights Reserved
*
* This source code and its use and distribution, is subject to the terms
* and conditions of the applicable license agreement.
*
-->
<html lang="en">
<head>
<title>BitmovinYospace Player WebOS</title>
Expand All @@ -21,24 +13,66 @@
/>
<link rel="stylesheet" href="src/css/style.css" />

<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-core.js"></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-polyfill.js"
></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-style.js"></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-xml.js"></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-advertising-core.js"
></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-advertising-bitmovin.js"
></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-mserenderer.js"
></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-engine-bitmovin.js"
></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-container-mp4.js"
></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-hls.js"></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-dash.js"></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-abr.js"></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-container-ts.js"
></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-engine-native.js"
></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-drm.js"></script>
<script
type="text/javascript"
src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-crypto.js"
></script>
<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/modules/bitmovinplayer-webos.js"></script>

<script type="text/javascript" src="https://cdn.bitmovin.com/player/web/8/bitmovinplayer-ui.js"></script>

<link rel="stylesheet" href="https://cdn.bitmovin.com/player/web/8/bitmovinplayer-ui.css" />

<script type="text/javascript" src="src/webOSTVjs-1.1.0/webOSTV.js"></script>
<script type="text/javascript" src="src/webOSTVjs-1.1.0/webOSTV-dev.js"></script>
<script type="text/javascript" src="src/js/bitmovin-player-yospace.min.js"></script>
<script type="text/javascript" src="src/js/yo-ad-management.min.js"></script>
<script type="text/javascript" src="src/js/bitmovin-player-yospace.js"></script>
<script type="text/javascript" src="src/js/sources.js"></script>
<!--<script type="text/javascript" src="src/js/main.js"></script>-->
</head>
<body>
<div id="wrapper">
<div id="banner">
<div class="logo">
<a href="https://bitmovin.com"
><img
src="https://ox4zindgwb3p1qdp2lznn7zb-wpengine.netdna-ssl.com/wp-content/themes/Bitmovin-V-0.1/images/logo4.png"
/></a>
<a href="https://bitmovin.com"><img src="src/images/bitmovin-logo.png" /></a>
</div>
<div class="title"><h1 class="bitmovin-headline">BitmovinYospace Player WebOS</h1></div>
<div class="clearfix"></div>
Expand Down Expand Up @@ -75,7 +109,7 @@ <h2>Unsupported Protocol</h2>
var truexAdFree = false; // disable Truex

var conf = {
key: 'edc2b14e-a636-49d7-a011-0c854fab98f3',
key: 'YOUR-KEY',
playback: {
muted: false,
autoplay: true,
Expand All @@ -91,11 +125,8 @@ <h2>Unsupported Protocol</h2>
},
ui: false,
tweaks: {
enable_seek_for_live: true,
resume_live_content_at_previous_position_after_ad_break: true,
file_protocol: true,
app_id: 'com.bitmovin.bitmovinyospaceplayer',
BACKWARD_BUFFER_PURGE_INTERVAL: 10,
app_id: 'com.bitmovin.bitmovinyospaceplayer.demo',
},
};

Expand All @@ -105,33 +136,64 @@ <h2>Unsupported Protocol</h2>
disableVpaidRenderer: false,
liveVpaidDurationAdjustment: 2,
disableStrictBreaks: false,
disableServiceWorker: true, //Disable Service Worker for Tizen Web App use
disableServiceWorker: true, //Disable Service Worker for WebOS Web App use
useWebos: true,
};

var sampleYospacePlayerPolicy = {
canMute: () => {
canMute: function () {
return true;
},
canSeek: () => {
canSeek: function () {
return true;
},
canSeekTo: (seekTarget) => {
canSeekTo: function (seekTarget) {
return seekTarget;
},
canSkip: () => {
canSkip: function () {
return true;
},
canPause: () => {
canPause: function () {
return true;
},
canChangePlaybackSpeed: () => {
canChangePlaybackSpeed: function () {
return true;
},
};

bitmovin.player.core.Player.addModule(window.bitmovin.player['polyfill'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['style'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['xml'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['advertising-core'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['advertising-bitmovin'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['engine-bitmovin'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['mserenderer'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['hls'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['dash'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['abr'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['container-ts'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['container-mp4'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['engine-native'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['drm'].default);
bitmovin.player.core.Player.addModule(window.bitmovin.player['crypto'].default);

if (!yospaceConfig.disableServiceWorker) {
bitmovin.player.core.Player.addModule(window.bitmovin.player['serviceworker-client'].default);
}

if (yospaceConfig.useWebos) {
bitmovin.player.core.Player.addModule(window.bitmovin.player['webos'].default);
}

var playerContainer = document.getElementById('player');
yospacePlayer = new bitmovin.player.ads.yospace.BitmovinYospacePlayer(playerContainer, conf, yospaceConfig);
yospacePlayer = new bitmovin.player.ads.yospace.BitmovinYospacePlayer(
bitmovin.player.core.Player,
playerContainer,
conf,
yospaceConfig
);

bitmovin.playerui.UIFactory.buildDefaultTvUI(yospacePlayer);

var keySystem = webOSDev && webOSDev.DRM.Type.WIDEVINE;
var webosDrmAgent = getDrmAgent(keySystem);
Expand All @@ -141,82 +203,8 @@ <h2>Unsupported Protocol</h2>
if (webosDrmAgent) {
isDrmLoaded(webosDrmAgent)
.then(function () {
yospacePlayer.setup().then(function () {
bitmovin.playerui.UIFactory.buildDefaultUI(yospacePlayer);

yospacePlayer.on('playbackfinished', function (event) {
console.info(event.time + ' - [YoSpacePlayer] playbackFinished: ' + JSON.stringify(event));
});

yospacePlayer.on('ready', function (event) {
console.info(event.time + ' - [YoSpacePlayer] ready: ' + JSON.stringify(event));
});

yospacePlayer.on('error', function (event) {
console.error(event.time + ' - [YoSpacePlayer] Error: ' + JSON.stringify(event));
});

yospacePlayer.on('warning', function (event) {
console.warn(event.time + ' - [YoSpacePlayer] Warning: ' + JSON.stringify(event));
});

yospacePlayer.on('play', function (event) {
console.info(event.time + ' - [YoSpacePlayer] play: ' + JSON.stringify(event));
});

yospacePlayer.on('timechanged', function (event) {
//console.trace(event.time + ' - [YoSpacePlayer] timechanged: ' + JSON.stringify(event));
});

yospacePlayer.on('adbreakstarted', function (event) {
console.info(event.time + ' - [YoSpacePlayer] AdBreakStarted: ' + JSON.stringify(event));
});

yospacePlayer.on('adbreakfinished', function (event) {
console.info(event.time + ' - [YoSpacePlayer] AdBreakFinished: ' + JSON.stringify(event));
});

yospacePlayer.on('adstarted', function (event) {
console.info(event.time + ' - [YoSpacePlayer] AdStarted: ' + JSON.stringify(event));
});

yospacePlayer.on('adfinished', function (event) {
console.info(event.time + ' - [YoSpacePlayer] AdFinished: ' + JSON.stringify(event));
});

yospacePlayer.on('adquartile', function (event) {
console.info(event.time + ' - [YoSpacePlayer] AdQuartileEvent: ' + JSON.stringify(event));
});

yospacePlayer.on('admanifestloaded', function (event) {
console.info(event.time + ' - [YoSpacePlayer] AdManifestLoaded: ' + JSON.stringify(event));
});

yospacePlayer.on('subtitleadded', function (event) {
console.info(event.time + ' - [YoSpacePlayer] SubtitleAdded: ' + JSON.stringify(event));
if (yospacePlayer.subtitles.list().length > 0) {
yospacePlayer.subtitles.enable(yospacePlayer.subtitles.list()[0].id);
}
});

yospacePlayer.on('playing', function (event) {
console.info(event.time + ' - [YoSpacePlayer] playing: ' + JSON.stringify(event));
if (yospacePlayer.subtitles.list().length > 0) {
yospacePlayer.subtitles.enable(yospacePlayer.subtitles.list()[0].id);
}
});

yospacePlayer.on('metadataparsed', function (event) {
console.debug(event.time + ' - [YoSpacePlayer] metadataParsed: ' + JSON.stringify(event));
});

yospacePlayer.on('metadata', function (event) {
console.debug(event.time + ' - [YoSpacePlayer] metadata: ' + JSON.stringify(event));
});

yospacePlayer.setPolicy(sampleYospacePlayerPolicy);
yospacePlayer.load(sources.vodSource);
});
yospacePlayer.setPolicy(sampleYospacePlayerPolicy);
yospacePlayer.load(sources.vodSource);
})
.catch(function (e) {
console.log('Error while loading drm Agent', e);
Expand All @@ -234,7 +222,11 @@ <h2>Unsupported Protocol</h2>
}
switch (keycode) {
case 13:
tooglePlayPause();
if (player.isPaused()) {
player.play();
} else {
player.pause();
}
break;
case 415:
// Play Button Pressed
Expand Down Expand Up @@ -262,14 +254,6 @@ <h2>Unsupported Protocol</h2>
});
}

function tooglePlayPause() {
if (player.isPaused()) {
player.play();
} else {
player.pause();
}
}

function getDrmAgent(keySystem) {
return webOSDev && keySystem && webOSDev.drmAgent(keySystem);
}
Expand Down Expand Up @@ -317,6 +301,58 @@ <h2>Unsupported Protocol</h2>
});
});
}

function addEventListeners() {
var infoEventList = [
'playbackfinished',
'ready',
'play',
'playing',
'adbreakstarted',
'adbreakfinished',
'adstarted',
'adfinished',
'adquartile',
'admanifestloaded',
'subtitleadded',
];
addEventLogger('info', infoEventList);

var errorEventList = ['error'];
addEventLogger('error', errorEventList);

var warningEventList = ['warning'];
addEventLogger('warning', warningEventList);

var traceEventList = ['timechanged'];
// addEventLogger('trace', traceEventList);

var debugEventList = ['metadataparsed', 'metadata'];
addEventLogger('debug', debugEventList);

yospacePlayer.on('subtitleadded', function (event) {
if (yospacePlayer.subtitles.list().length > 0) {
yospacePlayer.subtitles.enable(yospacePlayer.subtitles.list()[0].id);
}
});

yospacePlayer.on('playing', function (event) {
if (yospacePlayer.subtitles.list().length > 0) {
yospacePlayer.subtitles.enable(yospacePlayer.subtitles.list()[0].id);
}
});
}

function addEventLogger(type, eventList) {
eventList.forEach(function (eventName) {
yospacePlayer.on(eventName, function (event) {
var timestamp = new Date(event.timestamp).toISOString();
var playheadTime = event.time ? '@' + event.time : '@?';
var msg = '[' + timestamp + '][YoSpacePlayer][' + event.type + playheadTime + ']: ' + JSON.stringify(event);
console[type](msg);
});
});
}
</script>
</body>
</html>
63 changes: 0 additions & 63 deletions WebOS/src/js/bitmovin-player-yospace.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion WebOS/src/js/sources.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var sources = {
vodSource: {
title: 'VOD Stream',
hls: 'https://vod-manifests-aka-qa.warnermediacdn.com/csm/tcm/clear/3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c/master_cl.m3u8?afid=222591187&caid=2100555&conf_csid=tbs.com_videopage_test&context=182883174&nw=42448&prof=48804%3Amp4_plus_vast_truex&vdur=1800&yo.vp=true',
hls: 'https://csm-e-sdk-validation.bln1.yospace.com/csm/access/156611618/c2FtcGxlL21hc3Rlci5tM3U4?yo.av=3',
assetType: bitmovin.player.ads.yospace.YospaceAssetType.VOD,
},
artOfMotionSource: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "npm run copyStaticToDist && webpack serve --open --config webpack.dev.js",
"copyStaticToDist": "mkdir -p dist && cp src/index.html dist/ && cp src/sw.js dist/",
"copyToTizen": "cp ./dist/js/bitmovin-player-yospace.js ./tizen/js",
"copyToWebOS": "cp ./dist/js/bitmovin-player-yospace.min.js ./WebOS/src/js",
"copyToWebOS": "cp ./dist/js/bitmovin-player-yospace.js ./WebOS/src/js",
"lint": "eslint --quiet src/ && kacl lint",
"format": "prettier --write src/",
"clean": "rm -R ./dist",
Expand Down

0 comments on commit 21728fa

Please sign in to comment.