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

JW 6 resetting to auto in multibit rate menu fired when paused


Hello,

currently implementing the following code to reset the quality to "auto" when the page reloads:

jwplayer().onReady(function(event) {
jwplayer().onQualityLevels(function(event) {
jwplayer().setCurrentQuality(0);
});
});

The problem is that this code also fires if the player is paused. I tried to remove the call to onQualityLevels, but that brings back the problem of the quality level persisting between page visits.

Is there a way to force the quality to auto on the initial page load, but not when the player is simply paused?

Thanks



5 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Can I see a link to where this is running?

rewebit

User  
0 rated :

Hello,

I ended up with the following solution:

<script>
...
var setQuality = true;

jwplayer("player0").onReady(function(event) {
// reset the quality to Auto when the page is revisited
jwplayer("player0").onQualityLevels(function(event) {
if (setQuality) {
jwplayer("player0").setCurrentQuality(0);
setQuality = false;
}
});
});
...
</script>

if you can think of a better route to go without the variable, I would be interested.

Also, why can one simply not call jwplayer().setCurrentQuality(0); when needed? Calling this appears to have no effect.

Thanks

Robert

Ethan Feldman

JW Player Support Agent  
0 rated :

Glad you got it.

Hm, that call should work fine?

developer

User  
0 rated :

Why don´t you use the getState() Method to check if the player is PLAYING?


jwplayer("player0").onReady(function() {
if(jwplayer("player0").getState()!=PLAYING){
jwplayer("player0").setCurrentQuality(0);
}
}

developer

User  
0 rated :

better implement:

jwplayrt("id").setup({
//YOUR SETTINGS
}).onReady(function(){
if(this.getState()!="PLAYING"){
//WHEN NOT PLAYING
}
})

This question has received the maximum number of answers.