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

Flash methods (play and pause) do not work #38

Closed
tforster opened this issue Dec 5, 2010 · 8 comments
Closed

Flash methods (play and pause) do not work #38

tforster opened this issue Dec 5, 2010 · 8 comments

Comments

@tforster
Copy link

tforster commented Dec 5, 2010

This is a great plugin and is working well for us in development at the moment. However, one minor issue I've noticed is that the play() and pause() methods don't work against the Flash player. We are encoding just H.264 files and use mediaelement to support HTML5 or Flash for current Firefox and non-HTML5 browsers.

A new development involves a playlist with a click on a video thumbnail in the list to start the video playing in the main player window so .play() will be really useful.

@johndyer
Copy link
Collaborator

johndyer commented Dec 5, 2010

Could you show me how you're using the play and pause methods? In an updated version, I'm also making those methods public on the MediaElementPlayer object which might make it easier.

@tforster
Copy link
Author

tforster commented Dec 5, 2010

When the user rolls over the video when it's not playing a strip of thumbnails is displayed along the bottom just above the scrub bar. The opacity and background colour are the same as the scrub bar so it looks like it's part of the player controls.

The strip of thumbnails represent a playlist and a click on any of the thumbnails should load and play the associated video. I can toggle playing of HTML5 H.264 videos but not Flash H.264. I'm using $("video")[0].play() and $("video")[0].pause().

This is on my local dev server so I don't have an exposed endpoint that I can open right now otherwise I would invite you to see it directly.

@johndyer
Copy link
Collaborator

johndyer commented Dec 6, 2010

Unfortunately, there's no way to make the browsers work quite like that. Here's the syntax you should use:

// create the player object explicitly, not via jQuery().mediaelementplayer()
var player = new MediaElementPlayer('myvideid');

// call methods on the internal media object (you can leave off the .media in the latest code)
player.media.setSrc('mynewvideo.mp4');
player.media.load();
player.media.play();

Hope that helps!

@tforster
Copy link
Author

tforster commented Dec 6, 2010

John, thanks for replying so quickly. It's greatly appreciated. I will try your code tomorrow morning. Meanwhile, when you say there's no way to make the browsers work like that do you mean the browsers or the (flash) plugin? If I open a webkit console on your mediaelementjs.com page and execute $("video")[0].play() it starts the video. Correspondingly a .pause() halts it.

@johndyer
Copy link
Collaborator

johndyer commented Dec 6, 2010

I mean there is no way to get $("video")[0].play() to work in all browsers the same way since they don't support the same features.

Since webkit supports native H.264 playback, $("video")[0].play() will work. However, on IE8 which doesn't support the [video] tag $("video")[0].play() isn't available, and on Firefox which can't play H.264, $("video")[0].play() will fail.

@tforster
Copy link
Author

tforster commented Dec 6, 2010

Do'h! It's clear now. I'm still referencing the video element not the resulting mediaelement object :) It was a long day yesterday.

Thanks John and thank you for an awesome plugin too.

@johndyer
Copy link
Collaborator

johndyer commented Dec 6, 2010

Feel free to re-open this if you need to.

@clemmonsmc
Copy link

Using the above method, I am still unable to play an H.264 video on Firefox via a click method. Is the behavior I am see unexpected?

Here is my code:

var vp = new MediaElementPlayer('#video-player');
var tp = new MediaElementPlayer('#tour-player');

$('div.tabs ul.tabNavigation a[href="#video"]').click(function() {
   tp.pause();
   vp.load();
   vp.play();
});

$('div.tabs ul.tabNavigation a[href="#tour"]').click(function() {
   vp.pause();
   tp.load();
   tp.play();
});

This issue was closed.
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