2017-04-25 14 views
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); 

答えて

0

は、ローカルホスト上で実行してみます。あなたは、Python SimpleHTTPServerを使用することができます。

python -m SimpleHTTPServer 

とオープン

localhost:8000/{MOVIE_DIR}/Movie_WebM.html 

EMEが使用する安全なURLが必要です。つまり、httpsを使用するか、localhost上に置く必要があります。現在のところ、Chromeのみがそれを強制しますが、他のブラウザは今後使用されます。また、コンテンツ要件が混在しているため、サイトでhttpsを使用している場合は、マニフェストとすべてのセグメントでhttpsも使用する必要があります。 - https://shaka-player-demo.appspot.com/docs/api/tutorial-drm-config.html

関連する問題