-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<html> | ||
<head> | ||
<!-- for non-UI builds: --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/3.2.0/shaka-player.compiled.js"></script> | ||
<!-- or, for UI builds: --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/shaka-player/3.2.0/shaka-player.ui.js"></script> | ||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/shaka-player/3.2.0/controls.css"> | ||
<style> | ||
body { | ||
width:100%; | ||
height: 100%; | ||
font-family: Poppins; | ||
display:block; | ||
position: absolute; | ||
padding: 0px; | ||
margin: 0px; | ||
background: #000; | ||
} | ||
video{ | ||
width:100%; | ||
height: 100%; | ||
display:inline-block; | ||
-webkit-user-select:none; | ||
-moz-user-select:none; | ||
-ms-user-select:none; | ||
user-select:none; | ||
} | ||
a, a:hover, a:focus, a:active { | ||
text-decoration: none; | ||
} | ||
|
||
</style> | ||
<style> | ||
div a img{visibility:hidden;} | ||
body::before { | ||
position: absolute; | ||
top: 5px; | ||
right: 5px; | ||
z-index: 10; | ||
content: ''; | ||
height: 70px; | ||
width: 110px; | ||
background: url(' ') no-repeat; | ||
background-size: 110px auto, auto; | ||
opacity: 0.4; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<center> <div data-shaka-player-container style="max-width:40em" | ||
data-shaka-player-cast-receiver-id="1BA79154"> | ||
<!-- The data-shaka-player tag will make the UI library use this video element. | ||
If no video is provided, the UI will automatically make one inside the container div. --> | ||
|
||
<video autoplay data-shaka-player id="video" poster="" style="width:100%;height:100%"></video> | ||
</div> | ||
</div></center> | ||
<script> | ||
|
||
const manifestUri = | ||
'https://anevi-live-channel-cdn.mncnow.id/live/eds/ANTV/sa_dash_vmx/ANTV.mpd?begin=1679138810&end=1679144300'; | ||
|
||
async function init() { | ||
// When using the UI, the player is made automatically by the UI object. | ||
const video = document.getElementById('video'); | ||
const ui = video['ui']; | ||
const controls = ui.getControls(); | ||
const player = controls.getPlayer(); | ||
|
||
player.configure({ | ||
drm: { | ||
clearKeys: { | ||
// 'key-id-in-hex': 'key-in-hex', | ||
'4310edb8b9ffe79abb40bacafa778ec3': 'aebb7e86d8a336d9a93d3dd8a41153cf', | ||
} | ||
} | ||
}); | ||
|
||
// Attach player and ui to the window to make it easy to access in the JS console. | ||
window.player = player; | ||
window.ui = ui; | ||
|
||
// Listen for error events. | ||
player.addEventListener('error', onPlayerErrorEvent); | ||
controls.addEventListener('error', onUIErrorEvent); | ||
|
||
// Try to load a manifest. | ||
// This is an asynchronous process. | ||
try { | ||
await player.load(manifestUri); | ||
// This runs if the asynchronous load is successful. | ||
console.log('The video has now been loaded!'); | ||
} catch (error) { | ||
onPlayerError(error); | ||
} | ||
} | ||
|
||
function onPlayerErrorEvent(errorEvent) { | ||
// Extract the shaka.util.Error object from the event. | ||
onPlayerError(event.detail); | ||
} | ||
|
||
function onPlayerError(error) { | ||
// Handle player error | ||
console.error('Error code', error.code, 'object', error); | ||
} | ||
|
||
function onUIErrorEvent(errorEvent) { | ||
// Extract the shaka.util.Error object from the event. | ||
onPlayerError(event.detail); | ||
} | ||
|
||
function initFailed(errorEvent) { | ||
// Handle the failure to load; errorEvent.detail.reasonCode has a | ||
// shaka.ui.FailReasonCode describing why. | ||
console.error('Unable to load the UI library!'); | ||
} | ||
|
||
// Listen to the custom shaka-ui-loaded event, to wait until the UI is loaded. | ||
document.addEventListener('shaka-ui-loaded', init); | ||
// Listen to the custom shaka-ui-load-failed event, in case Shaka Player fails | ||
// to load (e.g. due to lack of browser support). | ||
document.addEventListener('shaka-ui-load-failed', initFailed); | ||
</script> | ||
</body> | ||
</html> |