LonnyGomes / vjs-video

An angular js directive for video.js
http://lonnygomes.github.io/vjs-video/
MIT License
75 stars 33 forks source link

change video and end callback inside angular controller #62

Open sanjib-dev opened 7 years ago

sanjib-dev commented 7 years ago

Please advice how to implement this functionalities. this is my start initialization - working fine $scope.media_setup = { sources: [ { src: "https://d24uab5gycr2uz.cloudfront.net/stockmarketexperts-output/output/lecture-3-video-3-factors-of-fundamental-analysis-sd.m3u8", type: "application/x-mpegURL", } ] };

then

$scope.changeVideo = function(){ $scope.playInstance.media_setup = { sources: [ { src: "https://d24uab5gycr2uz.cloudfront.net/stockmarketexperts-output/output/lecture-3-video-3-factors-of-fundamental-analysis-sd.m3u8", type: "application/x-mpegURL", } ] }; };

$scope.$on('vjsVideoReady',function(e,data){ $scope.playInstance = data.player; }); this is not working

tried also $scope.$on('$destroy',function(){ $scope.playInstance.dispose(); });

still no luck

display file

<video id="my_video_1"  class="video-js vjs-default-skin" controls preload="auto" width="640" height="268" vjs-media="media_setup" vjs-video vjs-setup='{ "playbackRates": [0.5, 1, 1.5, 2] }'>

    </video>

    <button ng-click="changeVideo()">Change</button>
sanjib-dev commented 7 years ago

manage to make this work like this which mentioned in an earlier post $scope.$on('vjsVideoReady',function(e,data){ $scope.playInstance = data.player; $scope.playInstance.on('ended',function(e){ console.log('ended'); }); });

ghost commented 7 years ago

@sanjib-dev So are you trying to play another video after the first one ends? If so, you can do this using vjs-media as mentioned in #13. Let me know if that works for you.

sanjib-dev commented 7 years ago

I am trying to load a new video if user clicks on the next item. my initial problem is resolved, but now can it be possible to change vjs-setup inside angular controller? as i tried to load my custom playlist with local videos as well as youtube videos one more thing.. can it be possible to add a adaptive control bar. i am using m3u8 master playlist to play videos with contrib-hls plugin