0
제가 원했던 것은 샤카 플레이어가 일하기를 원했습니다. 내 영화 디렉토리에있는 모든 파일을 나열했습니다. 내 매니페스트 파일 (.mpd)은 동일한 디렉토리에있는 5 개의 서로 다른 webm 비디오 스트림 파일로 구성되어 있습니다 (오디오가 없으므로이 시나리오에서는 중요하지 않습니다).가장 간단한 샤카 플레이어가 작동하지 않습니다.
https://shaka-player-demo.appspot.com/docs/api/tutorial-welcome.html
나는이 작동하지 않는 이유를 잘 모르겠어요 :
나는 꽤 많은 웹 사이트에서 튜토리얼을 따라 갔다. 누군가 도울 수 있습니까?
영화 디렉토리 :
Movie_WebM.html
shaka-player.compiled.js
Movie.js
Movie_Manifest.mpd
Movie_160x90_250k.webm
Movie_320x180_500k.webm
Movie_640x360_1000k.webm
Movie_640x360_750k.webm
Movie_1280x720_500k.webm
Movie_WebM.html :
<!DOCTYPE html>
<html>
<head>
<script src="shaka-player.compiled.js"></script>
<script src="Movie.js"></script>
</head>
<body>
<video id="video"
width="640"
poster="//shaka-player-demo.appspot.com/assets/poster.jpg"
controls></video>
</body>
</html>
Movie.js :
var manifestUri = 'Movie_Manifest.mpd';
function initApp() {
shaka.log.setLevel(shaka.log.Level.V1);
// Install built-in polyfills to patch browser incompatibilities.
shaka.polyfill.installAll();
// Check to see if the browser supports the basic APIs Shaka needs.
if (shaka.Player.isBrowserSupported()) {
// Everything looks good!
initPlayer();
} else {
// This browser does not have the minimum set of APIs we need.
console.error('Browser not supported!');
}
}
function initPlayer() {
// Create a Player instance.
var video = document.getElementById('video');
var player = new shaka.Player(video);
// Attach player to the window to make it easy to access in the JS console.
window.player = player;
// Listen for error events.
player.addEventListener('error', onErrorEvent);
// Try to load a manifest.
// This is an asynchronous process.
player.load(manifestUri).then(function() {
// 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.
}
function onErrorEvent(event) {
// Extract the shaka.util.Error object from the event.
onError(event.detail);
}
function onError(error) {
// Log the error.
console.error('Error code', error.code, 'object', error);
}
document.addEventListener('DOMContentLoaded', initApp);