Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

onPlay call back can't work in the mobile


Hello,

Is the JWPlayer onPlay call back support mobile?
I need callback a function when play the video, but it's not work, it's just open video for full screen and start play, it's work very well in the desktop.

I use iPhone 5S for test, and the iOS version is 7.

The code is like this:

jwplayer(id)
.setup({
file: videoURL,
image: imageURL,
width: objWidth,
height: objHeight,
modes: settings
})
.onPlay(function() {
this.stop();
alert(id);
if ($mediaWrapper.data('flag')) {
$mediaWrapper.data('flag', false);
xxx.set_popup(this, 'Play video');
}
});

8 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Can you provide a link?

yan

User  
0 rated :

Sorry, it's just in my local.
But you mean onPlay support mobile? Maybe I have issue in my code or maybe the version issue. I will try selves first.

I have another question, when I use stop() method in inPlay function, in the mobile, it will stop the video and go back to the page, is this correct??

yan

User  
0 rated :

type issue, I mean onPlay.

yan

User  
0 rated :

This issue already solved, it's OK now.
It's because in the original code, the modes is different.
In the mobile the modes is:

var settings = [{type: 'download'}];

var settings = [
{type: 'flash', src: Drupal.settings.jwplayer.player_path},
{type: 'html5'},
];

Sorry to bother again, could you explain this for me?
I'm not very understand about this modes variable.

yan

User  
0 rated :

By the way, I use jwplayer 5.7.
And I've tried on our project, if I use "download" type, the onPlay function is not work, and I use "flash" and "html5", it will work well.

But when I use "flash" and "html5", it will have an issue on play video, it can't play again, when I complete one video.

Ethan Feldman

JW Player Support Agent  
1 rated :

Modes is for JW5 only – http://www.longtailvideo.com/support/jw5/31141/jw-embedder-modes

Glad you solved it.

This is because download mode is not a player, it is just the option to download the file, so no API calls will work with download mode.

yan

User  
0 rated :

Thank very much, all problem was solved, you may close this topic.

Ethan Feldman

JW Player Support Agent  
0 rated :

Np!

This question has received the maximum number of answers.