Skip to content

Commit

Permalink
Merge pull request #254 from kaltura/add-offset-buffer-for-audio
Browse files Browse the repository at this point in the history
add opt_clearBufferOffset for audio
  • Loading branch information
joeyparrish committed Jan 6, 2016
2 parents e0ecfe4 + 143cda3 commit c103cf7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ Sanborn Hilland <sanbornh@rogers.com>
TalkTalk Plc <*@talktalkplc.com>
uStudio Inc. <*@ustudio.com>
Philo Inc. <*@philo.com>
Itay Kinnrot <Itay.Kinnrot@Kaltura.com>

1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ Timothy Drews <tdrews@google.com>
Vasanth Polipelli <vasanthap@google.com>
Vignesh Venkatasubramanian <vigneshv@google.com>
Seth Madison <seth@philo.com>
Itay Kinnrot <itay.kinnrot@kaltura.com>
6 changes: 5 additions & 1 deletion lib/player/i_video_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,16 @@ shaka.player.IVideoSource.prototype.selectVideoTrack =
* @param {number} id The |id| field of the desired AudioTrack object.
* @param {boolean} clearBuffer If true, removes the previous stream's content
* before switching to the new stream.
* @param {number=} opt_clearBufferOffset if |clearBuffer| and
* |opt_clearBufferOffset| are truthy, clear the stream buffer from the
* given offset (relative to the audio's current time) to the end of the
* stream.
*
* @return {boolean} True on success; otherwise, return false if the specified
* AudioTrack does not exist or if an audio stream does not exist.
*/
shaka.player.IVideoSource.prototype.selectAudioTrack =
function(id, clearBuffer) {};
function(id, clearBuffer, opt_clearBufferOffset) {};


/**
Expand Down
10 changes: 8 additions & 2 deletions lib/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,20 @@ shaka.player.Player.prototype.selectVideoTrack = function(id, opt_clearBuffer) {
* @param {number} id The |id| field of the desired AudioTrack object.
* @param {boolean=} opt_clearBuffer If true (and by default), removes the
* previous stream's content before switching to the new stream.
* @param {number=} opt_clearBufferOffset if |clearBuffer| and
* |opt_clearBufferOffset| are truthy, clear the stream buffer from the
* given offset (relative to the audio's current time) to the end of the
* stream.
*
* @return {boolean} True if the specified AudioTrack was found.
* @export
*/
shaka.player.Player.prototype.selectAudioTrack = function(id, opt_clearBuffer) {
shaka.player.Player.prototype.selectAudioTrack = function(id, opt_clearBuffer,
opt_clearBufferOffset) {
if (!this.videoSource_) return false;
var clearBuffer = (opt_clearBuffer == undefined) ? true : opt_clearBuffer;
return this.videoSource_.selectAudioTrack(id, clearBuffer);
return this.videoSource_.selectAudioTrack(id, clearBuffer,
opt_clearBufferOffset);
};


Expand Down
4 changes: 2 additions & 2 deletions lib/player/stream_video_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,8 @@ shaka.player.StreamVideoSource.prototype.selectVideoTrack =

/** @override */
shaka.player.StreamVideoSource.prototype.selectAudioTrack =
function(id, clearBuffer) {
return this.selectTrack_('audio', id, clearBuffer);
function(id, clearBuffer, opt_clearBufferOffset) {
return this.selectTrack_('audio', id, clearBuffer, opt_clearBufferOffset);
};


Expand Down

0 comments on commit c103cf7

Please sign in to comment.