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

Updated YouTube Tech #157

Closed
wants to merge 17 commits into from
Closed

Updated YouTube Tech #157

wants to merge 17 commits into from

Conversation

jhurliman
Copy link

I wrote a new YouTube tech following the latest VideoJS API conventions. It uses the YouTube iFrame embed method which automatically chooses between HTML5 or Flash when serving videos, staying true to the HTML5 nature of VideoJS :-).

I tested all of the basic functionality with the following platforms:

  • Chrome 17.0.963.79 on OSX Lion
  • Chrome 17.0.963.79 on Windows 7
  • iPhone Safari on iOS 5.0
  • iPad Safari on iOS 5.1

Testing on additional platforms and more API feature testing (such as swapping out the playing video with a src() call) is welcome.

@heff
Copy link
Member

heff commented Mar 22, 2012

Heck yeah, thanks for the help. I'm trying to get v3.2 out the door and then I'll dig in more. Cheers. -heff

@jhurliman
Copy link
Author

On my fork I also have a functional Vimeo tech, although it is limited compared to the YouTube tech. YouTube will give you a "chromeless" player allowing a VideoJS skin to be overlaid, while Vimeo insists on their interface always being present. Having the VideoJS and Vimeo interfaces fight with each other is no good, so I opted to auto-hide VideoJS controls with Vimeo and just use their interface. Better than nothing if you want to embed Vimeo videos with a universal player, but many people probably won't use this so I broke out each tech into a separate file to make building without YouTube or Vimeo support easier. I haven't looked at the plugin refactor branch so I'm not sure if this aligns with that work or not, but it seemed like a good first step.

I've also been working on audio-only support (using the latest video-js-swf binary for Flash mp3 playback) which I will commit to my fork when I get something working. My goal is to have one player that can handle audio and video across a wide number of providers and all popular browsers/devices. This is getting very close to that goal!

@heff
Copy link
Member

heff commented Mar 22, 2012

Awesome. Bummer about Vimeo, but I'm sure most people will be fine using the Vimeo interface and just happy to have a universal way to embed video.

I'm glad you were able to dig into audio support. The functionality has been in the swf for a bit, and just haven't had the time to run tests. Let me know how it goes.

@jhurliman
Copy link
Author

It looks like the events being fired are not quite matching up with what video.js requires to function properly. The first issue I'm running into is that the "playing" event is fired but not "play", which is listened for to swap the poster and big play image with the control bar.

A hacky fix in V.flash.onEvent() would be adding if (eventName === "playing") player.triggerEvent("play"); but this doesn't seem right. When should "playing" be fired vs. "play"?

@heff
Copy link
Member

heff commented Mar 31, 2012

Play should be triggered when play() is called or when autoplay is triggered. Playing should be triggered whenever the video goes from paused to playing, and I believe only once the video is actually playing, not just when it's been told to play. Digging into this more today. http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#event-definitions

@dominic-p
Copy link
Contributor

I am noticing some issues with the full screen functionality in my tests. On transition to and from full screen the video is paused, and when I click play, it starts over from the beginning. Also, after a full screen transition, the controls stop working and clicking on them causes the youtube javascript to throws this error: NPMethod called on non-NPObject wrapped JSObject!.

Other than that, it seems to be working great. Thanks for a great plugin.

@dominic-p
Copy link
Contributor

Also, one really minor thing I saw was that right now it doesn't check the protocol (https vs http) in the function to get the poster image. So, users could get the "unsecured resources on a secure page" warning that we all love so much.

@jhurliman
Copy link
Author

Thanks for the heads up, I'll take a look at both issues. Which browser/OS were you using when experiencing the fullscreen issues? Just in case I have any trouble reproducing it.

@dominic-p
Copy link
Contributor

Thanks. I was testing in Firefox 11 on Windows 7. When I get a chance I'll test some other browsers as well.

@dominic-p
Copy link
Contributor

Just tested in a couple more browsers (all on Windows 7). I'm not seeing any issues in IE8+ (there might be an issue with IE7, but I can't confirm that at the moment). In Chrome, everything seems to work perfectly, but I do get the following error in my console when the video is initially setup:

Unsafe JavaScript attempt to access frame with URL http://3strandsmarketing.com/video.php from frame with URL http://www.youtube.com/embed/Tblcf8MGorY?disablekb=1&enablejsapi=1&iv_load_policy=3&modestbranding=1&playerapiid=vjs-test-youtube_youtube_api&wmode=opaque&rel=0&showinfo=0&showsearch=0&controls=0&autoplay=0&loop=0&hd=0&origin=http%3A%2F%2F3strandsmarketing.com. Domains, protocols and ports must match.

@dominic-p
Copy link
Contributor

Just noticed another issue. It seems like the ready action for the main _V_ object isn't triggered if the video is not visible when it's setup. I don't know if this is just a consequence of YouTube's embed method, but I figured I'd bring it to your attention anyway.

After tinkering with this a bit, it seems like this might be connected to the NPMethod called on non-NPObject wrapped JSObject! error I mentioned earlier. I'm having trouble pinning down the exact cause, but it seems like the two problems might be connected.

@jameswann
Copy link

I found a small bug in core.js (line 116), you need to change it to this line:

techOrder: ["html5","flash", "youtube"],

This will allow more programmatic instantiation.

@mattgrayisok
Copy link

All seems to work fine for me in IE7,8,9, FF 11 and Chrome 19 once my above alteration had been made.

The only issue I'm seeing is the the UI doesn't reset when the tech switches (due to an .src() call). This just means that the progress bar and play/pause button might show the wrong state until the new video starts playing so not a big deal. I don't know if this has ever been addressed in the zencoder master branch either but it might be something for the future.

Cheers

@xbgmsharp
Copy link

Could you provide a working example?

@athieriot
Copy link

Hi there !

Do you think there is a chance to merge this PR anytime soon?
It's an awesome work.

Thank you

Aurélien

@talamaska
Copy link

yeah, I'm also user of that tech, it will be nice if we get merged all ull request that are waiting for half year already, minify was not so bad, I don't think closure is more important then fixing bugs with merge of pull requests that are fixing those bugs

@gefangenimnetz
Copy link

+1 for a merge.

@heff
Copy link
Member

heff commented Feb 8, 2013

@jhurliman, would you be interested in breaking this out into it's own repo? I'm currently heads down on refactoring the core project, and looking to keep it very focused, as in only HTML5 + Flash, and only features supported natively by HTML5 video. Everything else would be plugins/modules.

@jhurliman
Copy link
Author

Sure. Let me know when it's ready.

@clarkewd
Copy link

+1 for getting this to a usable state

@jhurliman
Copy link
Author

To everyone following this thread: We've recently switched away from video.js at MOX due to the lack of HLS support in Flash. I'm still interested in using video.js for side projects and maintaining the YouTube plugin, but we have a launch on March 15th and I don't have time for any extracurricular coding before then. If someone wants to jump in and get started on this now please feel free, otherwise I'll get started probably early April (2013).

@athieriot
Copy link

Thank you for this update !

Can you tell us what are you using now?

@jhurliman
Copy link
Author

I'm evaluating JWPlayer 6 and the Yospace HLS SDK for Flash.

@heff
Copy link
Member

heff commented Feb 21, 2013

We do have an HLS version in the works for those interested. Hoping to release it along with v4.

On Feb 21, 2013, at 2:23 PM, John Hurliman notifications@github.com wrote:

I'm evaluating JWPlayer 6 and the Yospace HLS SDK for Flash.


Reply to this email directly or view it on GitHub.

@heff
Copy link
Member

heff commented Mar 15, 2013

Closing this pull request for now since it's for the old version. There's a plugins page on the wiki for anyone who wants to create a youtube plugin.
https://github.com/zencoder/video-js/wiki/Video.js-Plugins

@heff heff closed this Mar 15, 2013
@kipotlea
Copy link

@heff @jhurliman : can videojs-youtube working perfectly with videojs-vast-plugin ?

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

Successfully merging this pull request may close these issues.