Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vjsVideoMediaChanged doesn't fire #50

Open
sergibondarenko opened this issue Dec 8, 2016 · 2 comments
Open

vjsVideoMediaChanged doesn't fire #50

sergibondarenko opened this issue Dec 8, 2016 · 2 comments

Comments

@sergibondarenko
Copy link

AngularJS 1.6
Video.js 5.14.1

I'm trying to reproduce the vjs-media="mediaToggle" example. The video plays successfully but I don't see the console message of the vjsVideoMediaChanged event.

@ghost
Copy link

ghost commented Dec 9, 2016

How are you looking for the event? Are you doing something like the following?

scope.$on('vjsVideoMediaChanged', function (e) {
    console.log(e);
});

@sergibondarenko
Copy link
Author

sergibondarenko commented Dec 10, 2016

I implemented it in the following way:

Controller:

angular.module('VideoChannelCtrl', [])
    .controller('VideoChannelController', ['$scope', function($scope) {

    $scope.mediaToggle = {
        sources: [
            {   
                src: 'http://media.w3.org/2010/05/sintel/trailer.mp4',
                type: 'video/mp4'
            },
            {   
                src: 'http://media.w3.org/2010/05/bunny/trailer.mp4',
                type: 'video/mp4'
            }
        ]
    };

    //listen for when the vjs-media object changes
    $scope.$on('vjsVideoMediaChanged', function (e, data) {
        console.log('vjsVideoMediaChanged event was fired');
    });

}]);

View:

<div class="main-player-container">
    <video class="video-js vjs-default-skin" autoplay preload="auto"
               width="592" height="252" vjs-video vjs-media="mediaToggle">
    </video>
</div>

index.html

...
    <script src="libs/angular/angular.min.js"></script>
    <script src="libs/angular-route/angular-route.min.js"></script>
    <script src="libs/videojs/dist/video.min.js"></script>
    <script src="libs/videojs-playlist/dist/videojs-playlist.min.js"></script>
    <script src="libs/vjs-video/dist/vjs-video.min.js"></script>

    <script src="js/app.js"></script>
    <script src="js/appRoutes.js"></script>
    <script src="js/services/CoubService.js"></script>
    <script src="js/controllers/VideoChannelCtrl.js"></script>
...
<body ng-app="fooApp" ng-controller="VideoChannelController">
<div ng-view></div>
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant