Skip to content

Changing source of playing youtube video to an mp4 video doesn't work #347

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

Closed
adamtal3 opened this issue Dec 19, 2015 · 3 comments
Closed

Comments

@adamtal3
Copy link

I've created a video player that can show videos from youtube or mp4 videos.

When the player is loaded on a youtube video, calling src with an mp4 source does nothing.

Example: http://jsfiddle.net/kocca6sb/1/

Can anyone spot the issue with different techs source changing? Is it really youtube plugin related?

@narration-sd
Copy link

I can give you a work-around -- really what it does is not try to use the youtube tech when playing an mp4. Quite possibly this is something the youtube plugin might arrange for itself.

I think the proper setup (someone may correct me on this) is that when playing an mp4, we should identify video-js.swf as the tech. This is so the swf player included with video-js will be used as fallback for browsers that don't do mp4 natively.

And naturally you want to be sure your source is labelled with the propermime code.

Here's how that works out:

<video id='yourid'
        ...rest of your setup...
    data-setup='{"techOrder" : ["youtube"]}'>

<source src="https://youtu.be/yourvideocode" type='video/mp4' />

Or, you could as seems hinted by the examples, just set techorder to empty brackets ({}) and include a nojs warning to upgrade to a modern browser that supports mp4. Empty brackets (think it defaults to that if you just leave data-setup out) works fine if you have such a browser and video/mp4 source.

@gkatsev
Copy link
Member

gkatsev commented May 10, 2016

It looks like the issue is that tech doesn't dispose itself properly and the youtube iframe stays around when the video is changed.

@gkatsev
Copy link
Member

gkatsev commented Jul 8, 2016

A new version with this fix is now released.

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

3 participants