Skip to content

Commit

Permalink
add 'useLiveStreamMinDuration' flashvar: when set to true, livestream…
Browse files Browse the repository at this point in the history
… duration will be the last current point and not the dvr window size
  • Loading branch information
MichalRadwantzor committed Dec 31, 2013
1 parent 9b57a7b commit fefcb06
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions kdp3Lib/docs/flashvars.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ Miscellaneous

disablePlayerSpinner = [true / false]
When this parameter is set to true the buffering animtaion won't appear. Default value is false.

useLiveStreamMinDuration = [true / false ]
relevant for livestream with dvr window. When this paramter is set to true, entry duration will be set once, by the current dvr time, and it will be the maximum point to view the livestream.
Default vlaue is false

Components & Plug-ins attributes
--------------------------------
Expand Down
29 changes: 26 additions & 3 deletions kdp3Lib/src/com/kaltura/kdpfl/view/media/KMediaPlayerMediator.as
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ package com.kaltura.kdpfl.view.media
*/
private var _mediaErrorSent:Boolean = false;

/**
* when playing livestream with useLiveStreamMinDuration flag, this flag will indicate duration for the first time wasn't set yet
* */
private var _liveDurationSet:Boolean = false;

/**
* Constructor
* @param name
Expand Down Expand Up @@ -357,7 +362,8 @@ package com.kaltura.kdpfl.view.media
{
_mediaProxy.vo.canSeek = true;
dvrWinSize = (_mediaProxy.vo.entry as KalturaLiveStreamEntry).dvrWindow * 60;
sendNotification( NotificationType.DURATION_CHANGE , {newValue:dvrWinSize});
if ( !_flashvars.useLiveStreamMinDuration )
sendNotification( NotificationType.DURATION_CHANGE , {newValue:dvrWinSize});
}

break;
Expand All @@ -381,6 +387,7 @@ package com.kaltura.kdpfl.view.media
_hasPlayed = false;
ignorePlaybackComplete = false;
_mediaErrorSent = false;
_liveDurationSet = false;
//Fixed weird issue, where the CHANGE_MEDIA would be caught by the mediator
// AFTER the new media has already loaded. Caused media never to be loaded.
if (designatedEntryId != _mediaProxy.vo.entry.id || _mediaProxy.vo.isFlavorSwitching )
Expand Down Expand Up @@ -1312,6 +1319,12 @@ package com.kaltura.kdpfl.view.media
sendNotification( NotificationType.ENABLE_GUI , {guiEnabled : false , enableType : EnableType.CONTROLS} );

}

if ( _mediaProxy.vo.isLive && _duration && _flashvars.useLiveStreamMinDuration ) {
if ( event.time >= _duration ) {
sendNotification( NotificationType.DO_PAUSE );
}
}
}
}

Expand Down Expand Up @@ -1400,7 +1413,7 @@ package com.kaltura.kdpfl.view.media
sendNotification( NotificationType.DURATION_CHANGE , {newValue:_entryDuration});
if (isMP4Stream())
{
if (!isNaN(event.time) && event.time )
if ( !isNaN(event.time) && event.time )
{
_offsetAddition = _entryDuration - event.time ;
sendNotification(NotificationType.RE_REGISTER_CUE_POINTS, {offsetAddition: _offsetAddition});
Expand All @@ -1419,7 +1432,17 @@ package com.kaltura.kdpfl.view.media
if (!_sequenceProxy.vo.isInSequence && (_mediaProxy.vo.entry is KalturaLiveStreamEntry &&
(_mediaProxy.vo.entry as KalturaLiveStreamEntry).dvrStatus == KalturaDVRStatus.ENABLED))
{
_duration = Math.max(dvrWinSize, event.time);
if ( _flashvars.useLiveStreamMinDuration ) {
if ( !_liveDurationSet ) {
_liveDurationSet = true;
_duration = Math.min(dvrWinSize, event.time);
} else { //don't send durationChange notification
return;
}

} else {
_duration = Math.max(dvrWinSize, event.time);
}
}
else
{
Expand Down

0 comments on commit fefcb06

Please sign in to comment.