Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[#1320] Cache volume values for synch reasons, and properly update mu…

…ted cache value if added after media ready. Fix html5 to youtube volume scale. Youtube uses a scale of 0-100, html5 is 0-1.
  • Loading branch information...
commit 49768bfc6cf484ea914d6cd05690923417b9fe02 1 parent 0d09236
@ScottDowne authored
Showing with 6 additions and 8 deletions.
  1. +6 −8 wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
View
14 wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
@@ -73,7 +73,7 @@
controls: true,
loop: false,
poster: EMPTY_STRING,
- volume: -1,
+ volume: 1,
muted: false,
currentTime: 0,
duration: NaN,
@@ -490,27 +490,25 @@
}
function setVolume( aValue ) {
+ impl.volume = aValue;
if( !mediaReady ) {
- impl.volume = aValue;
addMediaReadyCallback( function() {
setVolume( impl.volume );
});
return;
}
- player.setVolume( aValue );
+ player.setVolume( impl.volume * 100 );
self.dispatchEvent( "volumechange" );
}
function getVolume() {
- if( !mediaReady ) {
- return impl.volume > -1 ? impl.volume : 1;
- }
- return player.getVolume();
+ // YouTube has getColume(), but for sync access we use impl.volume
+ return impl.volume;
}
function setMuted( aValue ) {
+ impl.muted = aValue;
if( !mediaReady ) {
- impl.muted = aValue;
addMediaReadyCallback( function() { setMuted( impl.muted ); } );
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.