Open eduardonwa opened 3 years ago
Just wanted to update this: there are "embed" URL's which I suppose is more or less what im looking for.
You can set a source url via .src()
rather than by requiring it in the Video.js options.
Something like:
var player = videojs('my-player', { /* various options */ });
player.src({
type: 'video/youtube',
src: getYoutubeUrl()
});
Where getYoutubeUrl
will fill out your example https://www.youtube.com/watch?v={{ $thps4Video['ID'] }}
I am working with an API that has many videos, for example http://thvid-api.herokuapp.com/videos/game/THPS4 this is an array of about 300+ youtube videos, I am grabbing the position from each item, in a variable I store the "key" for each one of the videos so in the URL I have this: https://imgur.com/62leXW0
The way im using the youtube ext. is just by giving it your "regular" youtube link, so like this :
"src": "https://www.youtube.com/watch?v={{ $thps4Video['ID'] }}"}],
This throws an error but I think the question needs to be, if I wanted to use the embedded piece of code from youtube, how can I do that with the extension? I would like to be able to display the correct video by passing the ID for each video and insert that on the youtube URL, hope that makes sense.
https://codepen.io/eduardonwa/pen/YzNLevN