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

Support for <iframe> #587

Open
eduardonwa opened this issue Apr 14, 2021 · 2 comments
Open

Support for <iframe> #587

eduardonwa opened this issue Apr 14, 2021 · 2 comments

Comments

@eduardonwa
Copy link

eduardonwa commented Apr 14, 2021

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

@eduardonwa eduardonwa changed the title Is there support for using <iframe> Is there support for using <iframe> ? Apr 14, 2021
@eduardonwa eduardonwa changed the title Is there support for using <iframe> ? Support for <iframe> Apr 14, 2021
@eduardonwa
Copy link
Author

Just wanted to update this: there are "embed" URL's which I suppose is more or less what im looking for.

@gkatsev
Copy link
Member

gkatsev commented Apr 16, 2021

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'] }}

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

2 participants