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

set primary with JavaScript


Hello,

It was mentionen in the link at the bottom of this post, that we should set the primary as "flash" when the computer is running Safari on OSX and iOS.

In this manner we work around the problem of that combination not showing the multibit menu. Have been looking for an example of how to do this with the JW JavaScript API, have not been able to find an example on this site. Can someone point me to an example of how this can be done? Thank you.



http://support.jwplayer.com/customer/portal/questions/8114719-jw-6-problem-with-multi-bit-menu-not-displaying-

3 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

How about a toggle option?

https://github.com/emaxsaun/toggle

http://www.pluginsbyethan.com/github/toggle.html

rewebit

User  
0 rated :

Thank you for the example. We have opted to go with switching the primary through JavaScript. Placing a button on the player and then assuming users know when to use it, wasn't the route for us.

Going to paste what will be a partial solution which will hopefully help others...partial becuase everyone probably has script already to detect browser, os, etc..

// BEGIN JavaScript section of your code ---------
var primary = getPrimaryRenderingMode();

// configuration Player 0
jwplayer("player0").setup({
sources: [
{file: "your_file_here_1"},
{file: "your_file_here_2"}
],
rtmp: {
bufferlength: 0
},
primary: primary,
autostart: false,
fallback: false
});


function getPrimaryRenderingMode() {
if(<logic to determine if primary should be set to "flash">) {
return 'flash';
}
// otherwise return "html5"
return 'html5';
}

// END JavaScript


Thanks again
Robert

Ethan Feldman

JW Player Support Agent  
0 rated :

Np :)

This question has received the maximum number of answers.