2017-05-29 8 views
1

私の要件は本当に簡単です。現在実行中のビデオが終了するとすぐに、Web用Google VRViewで別の360°ビデオをロードする必要があります。Google VRView for Web - 360°ビデオが終了したときに検出する

documentationには4種類のイベントが記載されていますが、残念ながらビデオの終了を検出するイベントはありません。私はループを無効にするプロパティを見つけることさえできませんでした。

誰もこのようなものを実装できましたか?

var vrView = new VRView.Player('#vrview', { 
 
    video: 'link/to/first-video.mp4', 
 
    is_stereo: true 
 
    }); 
 

 

 
// I couldn't find an event like this or another solution 
 

 
vrView.on('end', function() { 
 

 
    vrView.setContent({ 
 
    video: 'link/to/second-video.mp4', 
 
    is_stereo: true 
 
    }); 
 

 
});

答えて

1

あなたが言うようにドキュメントは、イベントの4種類を示しているが、GitHubの上のソースは、実際に(https://github.com/googlevr/vrview)「終了」のいずれかをサポートし、追加的なようです。あなたはそれがmain.jsで定義され、player.jsに使用見ることができます

Player.prototype.onMessage_ = function(event) { 
    var message = event.data; 
    if (!message || !message.type) { 
    console.warn('Received message with no type.'); 
    return; 
    } 
    var type = message.type.toLowerCase(); 
    var data = message.data; 

    switch (type) { 
    case 'ready': 
    case 'modechange': 
    case 'error': 
    case 'click': 
    case 'ended': 
     if (type === 'ready') { 
     if (data !== undefined) { 
      this.duration = data.duration; 
    } 
     } 
関連する問題