Skip to content

Instantly share code, notes, and snippets.

@samueleastdev
Created August 24, 2023 16:38
Show Gist options
  • Save samueleastdev/d1b5b88da10482fac5586d39687984be to your computer and use it in GitHub Desktop.
Save samueleastdev/d1b5b88da10482fac5586d39687984be to your computer and use it in GitHub Desktop.
Crash Example
<html><head><title>AAMP playback in WPE browser using UVE APIs</title></head>
<script>
let url = "https://g004-vod-us-cmaf-prd-cf.cdn.peacocktv.com/pub/global/evh/Xa0/PCK_1664984712313.613_01/cmaf/mpeg_cenc/master_cmaf.m3u8?c3.ri=3779169266227869059";
let defaultConfig = {
asyncTune: false,
downloadStallTimeout: 5,
downloadStartTimeout: 3,
manifestTimeout: 1.0,
useRetuneForUnpairedDiscontinuity: true,
playlistTimeout: 10,
parallelPlaylistDownload: true,
preCachePlaylistTime: 5,
stereoOnly: true,
useAverageBandwidth: true,
useWesterosSink: true,
initFragmentRetryCount: 3,
enableSeekableRange: true,
}
window.onload = function() {
const player = new AAMPMediaPlayer('Peacock'); // Adding peacock params fails
console.log('Player loaded...');
player.initConfig(defaultConfig);
let license = "vMyXzk26A==";
player.setDRMConfig({
'com.widevine.alpha': `https://ovp.peacocktv.com/drm/widevine/acquirelicense?bt=${license}`,
preferredKeysystem: 'com.widevine.alpha'
});
player.addEventListener('playbackStateChanged', (state) => {
console.log(state);
});
player.addEventListener('bitrateChanged', (bitrate) => {
console.log('Current Video Bitrate', bitrate);
console.log('Video Bitrates', player.getVideoBitrates());
});
player.load(url, true, { contentType: 'VOD' });
setTimeout(() => {
console.log('load called again with same url');
defaultConfig.maxBitrate = 915905;
player.initConfig(defaultConfig);
player.load(url, true, { contentType: 'VOD' });
}, 15000) // 6 minutes / 360000
}
</script>
<body>
<video style="height:720px; width:1280px; position:absolute; bottom:0; left:0" src="dummy.mp4" type="video/ave"/>
</video>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment