angular-social-video-player
Demo for directive
by Hugo Capocci
HTML
<script src="https://code.angularjs.org/1.4.9/angular.min.js"></script>
<script src="https://rawgit.com/HugoCapocci/angular-social-video-player/master/dist/player.min.js"></script>
<div ng-controller="MyCtrl">
<div sv-player auto-play="{{options.autoPlay}}" height="400" width="600" pause="{{options.pause}}" video-provider="{{options.videoProvider}}" video-id="{{options.videoId}}">
</div>
</div>
JavaScript
var myApp = angular.module('myApp', ['socialVideoPlayer']);
function MyCtrl($scope, $window) {
$scope.options = {
autoPlay: false,
pause: false,
videoProvider: 'youtube',
videoId: '6SPJGIKZzp0'
};
// player events
$scope.$on('videoStarted', function(e, currentTime) {
$window.alert('videoStarted, time is ' + currentTime);
});
$scope.$on('videoPaused', function(e, currentTime) {
$window.alert('videoPaused, time is ' + currentTime);
});
$scope.$on('videoFinished', function(e, currentTime) {
$window.alert('videoFinished, time is ' + currentTime);
});
}
myApp.controller('MyCtrl', ['$scope', '$window', MyCtrl]);