videojs / videojs-vimeo

Support Vimeo source for Video.js
MIT License
196 stars 204 forks source link

Changing source to a new vimeo link #93

Open cronicryo opened 7 years ago

cronicryo commented 7 years ago

i have a gallery view that i was trying to have one video player and set dynamically went through the source code and found that src and setSrc were doing nothing with some digging i changed the src function to

src: function(source) {
        if (source && this.iframe) {
            this.videoId = Vimeo.parseUrl(source).videoId
            this.iframe.setAttribute('src', this.baseUrl + this.videoId + '?api=1&player_id=' + this.options_.techId);
        }else {
            return this.source;
        }

    },

is there a reason why this wasnt implemented at all?

the setSrc has an if at the top to always just return also trying to sift through it it doesnt seem like it would work anyway

samueleastdev commented 7 years ago

I think you can change the src by using loadVideo from the Vimeo api.

player.loadVideo(76979871).then(function(id) {
    // the video successfully loaded
}).catch(function(error) {
    switch (error.name) {
        case 'TypeError':
            // the id was not a number
            break;

        case 'PasswordError':
            // the video is password-protected and the viewer needs to enter the
            // password first
            break;

        case 'PrivacyError':
            // the video is password-protected or private
            break;

        default:
            // some other error occurred
            break;
    }
});

https://github.com/vimeo/player.js#loadvideoid-number-promisenumber-typeerrorpassworderrorerror

But not sure how to implement this?

colecmc commented 7 years ago

Has there been any updates to this? I have about 20 videos loading now and it would be great to switch the source instead.