NamPNQ / bower-videogular-youtube

Videogular `youtube` plugin repository for distribution on `bower`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot play videos in a playlist with non-youtube videos

degrov opened this issue · comments

Seems the plugin code overrides "mediaelement" functions without reverting back to original functions on video complete. This causes problem when trying to play the next non-youtube video by changing videogular source.

    API.mediaElement[0].__defineGetter__("duration", function () {
        return ytplayer.getDuration();
    });

    API.mediaElement[0].__defineGetter__("currentTime", function () {
        return ytplayer.getCurrentTime();
    });

    API.mediaElement[0].__defineSetter__("currentTime", function (seconds) {
        return ytplayer.seekTo(seconds, true);
    });
...
    API.mediaElement[0].play = function () {
        ytplayer.playVideo();
    };
    API.mediaElement[0].pause = function () {
        ytplayer.pauseVideo();
    };
...

Hi,

I have the same problem. In Firebug, the log of the error is the following:
Error: this.a is null g.C@https://s.ytimg.com/yts/jsbin/www-widgetapi-vflpJ8svn/www-widgetapi.js:100:77 Q@https://s.ytimg.com/yts/jsbin/www-widgetapi-vflpJ8svn/www-widgetapi.js:92:97 Ob/</this[a]@https://s.ytimg.com/yts/jsbin/www-widgetapi-vflpJ8svn/www-widgetapi.js:134:124 onVideoReady/API.mediaElement[0].play@http://localhost:8031/js/lib/videogular/youtube.js:104:33 this.play@http://localhost:8031/js/lib/videogular/videogular.js:431:13 this.playPause@http://localhost:8031/js/lib/videogular/videogular.js:413:17 onClickOverlayPlay@http://localhost:8031/js/lib/videogular/vg-overlay-play.js:59:25 anonymous/fn@http://localhost:8031/js/lib/angular.min.js line 231 > Function:2:242 b@http://localhost:8031/js/lib/angular.min.js:126:19 Kc[b]</<.compile/</</e@http://localhost:8031/js/lib/angular.min.js:274:195 uf/this.$get</m.prototype.$eval@http://localhost:8031/js/lib/angular.min.js:145:103 uf/this.$get</m.prototype.$apply@http://localhost:8031/js/lib/angular.min.js:145:335 Kc[b]</<.compile/</<@http://localhost:8031/js/lib/angular.min.js:274:245 r.event.dispatch@http://localhost:8031/js/lib/jquery.min.js:3:9870 r.event.add/q.handle@http://localhost:8031/js/lib/jquery.min.js:3:7932

I do the same analysis. The youtube player is destroyed but the function onVideoReady() of the plugin is called and the API.mediaElement is altered.

Did you find a solution ?