benjipott / video.js-chromecast

Use chromecast with videojs html5 player
Other
207 stars 86 forks source link

dynamic src - error when stop casting #9

Closed mattsobo closed 7 years ago

mattsobo commented 8 years ago

If I load the player via the following:

videojs("example_video_1", config).ready(function() {
    vjsPlayer = this;
    vjsPlayer.chromecast.options.appId = "APP-ID";
    vjsPlayer.src( [
            { type: "video/webm", src: "http://vjs.zencdn.net/v/oceans.webm" },
            { type: "video/mp4", src: "http://vjs.zencdn.net/v/oceans.mp4" },
            { type: "video/ogg", src: "http://vjs.zencdn.net/v/oceans.ogv" }
        ]);
    vjsPlayer.play();
});

The error occurs because this.player.options['sources'] is empty. My video tag has no sources defined as these are loaded dynamically via the script. Can the src also be queried to get a list of videos? Also, this.player_.currentTime() returns 0 no matter where the playback is.

key: 'onStopAppSuccess',
value: function onStopAppSuccess() {
    this.casting = false;
    var time = this.player_.currentTime();
    this.removeClass('connected');
ERROR//-->  this.player_.src(this.player_.options_['sources']); <--// ERROR
    if (!this.player_.paused()) {
        this.player_.one('seeked', function () {
            return this.player_.play();
chemoish commented 7 years ago

@benjipott any update? Is this being maintained?

this.player_.options_['sources'] probably should be rewritten to this.player().currentSrc() so you aren't accessing "private" variables. However, that will only get the previously active source.

Also, the this.player_.options_['sources'] is only generated via the Player.getTagSettings() method that is called in the constructor. So dynamic sources would be impossible to retrieve.

Complex sources aren't even available in video.js, but I have had an outstanding pull request for those features.

SEE: https://github.com/videojs/video.js/pull/2678

gabehayes commented 7 years ago

14 should address this particular issue.