Commit a480a502 by Nishant Karandikar Committed by muzaffaryousaf

Remove unnecessary param in function declaration & calls

There was previously a bug in the Youtube API that caused videos
to not play at a set speed in Safari. The bug has apparently since
been fixed, so we no longer need code for that browser
special case.
parent 97ec1cec
...@@ -436,7 +436,7 @@ function(VideoPlayer) { ...@@ -436,7 +436,7 @@ function(VideoPlayer) {
state.speed = '2.0'; state.speed = '2.0';
state.videoPlayer.onPlay(); state.videoPlayer.onPlay();
expect(state.videoPlayer.setPlaybackRate) expect(state.videoPlayer.setPlaybackRate)
.toHaveBeenCalledWith('2.0', true); .toHaveBeenCalledWith('2.0');
state.videoPlayer.onPlay(); state.videoPlayer.onPlay();
expect(state.videoPlayer.setPlaybackRate.calls.count()) expect(state.videoPlayer.setPlaybackRate.calls.count())
.toEqual(1); .toEqual(1);
...@@ -943,9 +943,8 @@ function(VideoPlayer) { ...@@ -943,9 +943,8 @@ function(VideoPlayer) {
state.isHtml5Mode.and.returnValue(false); state.isHtml5Mode.and.returnValue(false);
state.videoPlayer.isPlaying.and.returnValue(true); state.videoPlayer.isPlaying.and.returnValue(true);
VideoPlayer.prototype.setPlaybackRate.call(state, '0.75'); VideoPlayer.prototype.setPlaybackRate.call(state, '0.75');
expect(state.videoPlayer.updatePlayTime).toHaveBeenCalledWith(60); expect(state.videoPlayer.player.setPlaybackRate)
expect(state.videoPlayer.player.loadVideoById) .toHaveBeenCalledWith('0.75');
.toHaveBeenCalledWith('videoId', 60);
}); });
it('in Flash mode and video not started', function() { it('in Flash mode and video not started', function() {
...@@ -953,15 +952,7 @@ function(VideoPlayer) { ...@@ -953,15 +952,7 @@ function(VideoPlayer) {
state.isHtml5Mode.and.returnValue(false); state.isHtml5Mode.and.returnValue(false);
state.videoPlayer.isPlaying.and.returnValue(false); state.videoPlayer.isPlaying.and.returnValue(false);
VideoPlayer.prototype.setPlaybackRate.call(state, '0.75'); VideoPlayer.prototype.setPlaybackRate.call(state, '0.75');
expect(state.videoPlayer.updatePlayTime).toHaveBeenCalledWith(60); expect(state.videoPlayer.player.setPlaybackRate).toHaveBeenCalledWith('0.75');
expect(state.videoPlayer.seekTo).toHaveBeenCalledWith(60);
expect(state.trigger).toHaveBeenCalledWith(
'videoProgressSlider.updateStartEndTimeRegion',
{
duration: 60
});
expect(state.videoPlayer.player.cueVideoById)
.toHaveBeenCalledWith('videoId', 60);
}); });
it('in HTML5 mode', function() { it('in HTML5 mode', function() {
...@@ -975,9 +966,7 @@ function(VideoPlayer) { ...@@ -975,9 +966,7 @@ function(VideoPlayer) {
state.videoPlayer.isPlaying.and.returnValue(false); state.videoPlayer.isPlaying.and.returnValue(false);
VideoPlayer.prototype.setPlaybackRate.call(state, '1.0'); VideoPlayer.prototype.setPlaybackRate.call(state, '1.0');
expect(state.videoPlayer.updatePlayTime).toHaveBeenCalledWith(60); expect(state.videoPlayer.player.setPlaybackRate).toHaveBeenCalledWith('1.0');
expect(state.videoPlayer.player.cueVideoById)
.toHaveBeenCalledWith('videoId', 60);
}); });
}); });
}); });
......
...@@ -109,16 +109,7 @@ function(HTML5Video, Resizer) { ...@@ -109,16 +109,7 @@ function(HTML5Video, Resizer) {
// starts playing. Just after that configurations can be applied. // starts playing. Just after that configurations can be applied.
state.videoPlayer.ready = _.once(function() { state.videoPlayer.ready = _.once(function() {
if (!state.isFlashMode() && state.speed != '1.0') { if (!state.isFlashMode() && state.speed != '1.0') {
// Work around a bug in the Youtube API that causes videos to state.videoPlayer.setPlaybackRate(state.speed);
// play at normal speed rather than at the configured speed in
// Safari. Setting the playback rate to 1.0 *after* playing
// started and then to the actual value tricks the player into
// picking up the speed setting.
if (state.browserIsSafari && state.isYoutubeType()) {
state.videoPlayer.setPlaybackRate(1.0, false);
}
state.videoPlayer.setPlaybackRate(state.speed, true);
} }
}); });
...@@ -381,10 +372,7 @@ function(HTML5Video, Resizer) { ...@@ -381,10 +372,7 @@ function(HTML5Video, Resizer) {
} }
} }
function setPlaybackRate(newSpeed, useCueVideoById) { function setPlaybackRate(newSpeed) {
var duration = this.videoPlayer.duration(),
time = this.videoPlayer.currentTime;
this.videoPlayer.player.setPlaybackRate(newSpeed); this.videoPlayer.player.setPlaybackRate(newSpeed);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment