mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-26 17:46:26 +03:00
@@ -49,7 +49,7 @@ function initApp() {
|
||||
}
|
||||
}
|
||||
|
||||
function initPlayer() {
|
||||
async function initPlayer() {
|
||||
// Create a Player instance.
|
||||
const video = document.getElementById('video');
|
||||
const player = new shaka.Player(video);
|
||||
@@ -62,10 +62,14 @@ function initPlayer() {
|
||||
|
||||
// Try to load a manifest.
|
||||
// This is an asynchronous process.
|
||||
player.load(manifestUri).then(function() {
|
||||
try {
|
||||
await player.load(manifestUri);
|
||||
// This runs if the asynchronous load is successful.
|
||||
console.log('The video has now been loaded!');
|
||||
}).catch(onError); // onError is executed if the asynchronous load fails.
|
||||
} catch (e) {
|
||||
// onError is executed if the asynchronous load fails.
|
||||
onError(e);
|
||||
}
|
||||
}
|
||||
|
||||
function onErrorEvent(event) {
|
||||
|
||||
Reference in New Issue
Block a user