Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[#1320] Cache volume values for synch reasons, and properly update muted... #252

Open
wants to merge 2 commits into from

3 participants

@ScottDowne
Owner

... cache value if added after media ready. Fix html5 to youtube volume scale. Youtube uses a scale of 0-100, html5 is 0-1.

@ScottDowne ScottDowne [#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.
49768bf
wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
((14 lines not shown))
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
@mjschranz Owner

volume

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jbuck jbuck commented on the diff
wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
@@ -490,27 +490,25 @@
}
function setVolume( aValue ) {
+ impl.volume = aValue;
@jbuck Owner
jbuck added a note

Is it worth having a sanity check in here? IE is this a number between 0 and 1?

Edit - HTML5 video throws an exception (gross!) if you set the volume outside this range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 13, 2012
  1. @ScottDowne

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

    ScottDowne authored
    …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.
  2. @ScottDowne

    [#1320] Typo fix.

    ScottDowne authored
This page is out of date. Refresh to see the latest.
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;
@jbuck Owner
jbuck added a note

Is it worth having a sanity check in here? IE is this a number between 0 and 1?

Edit - HTML5 video throws an exception (gross!) if you set the volume outside this range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 getVolume(), 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;
}
Something went wrong with that request. Please try again.