2016-07-20 4 views

答えて

0

あなたは、このようなコードを持っているHTMLの場合:

<div class="modulo-textos" ng-repeat="video in videos track by $index"> 
    <iframe id="player{{$index + 1}}" ng-src="{{getVideoUrl(video, $index)}}" width="100%" height="350px" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 
</div> 

動画それはあなたが選別したい動画の情報を持つ配列ですが、上の「インデックスによってトラック」を追加することを忘れないでくださいng-repeatタグ。コントローラで

:ビデオの場合は、コンソール上のビデオオブジェクトが印刷されますが終了したら

$scope.getVideoUrl = function(video, index) { 
    var player_id = 'player' + (index + 1); 
    var video_url = 'https://player.vimeo.com/video/' + video.video_id + '?api=1&player_id=' + player_id; 
    var player = '#' + player_id; 
    var iframe = $(player)[0]; 
    var player = $f(iframe); 
    player.addEvent('ready', function() { 
    player.addEvent('finish', onFinish); 
    }); 
    function onFinish() { 
    console.log(video); 
    }; 
    return video_url; 
    }; 

:あなたは、この1のような機能を持っています。 「onPause」や「onPlayProgress」のような機能を追加できます。

関連する問題