Skip to content

Commit

Permalink
SUP-18414 dvr clip from (#613)
Browse files Browse the repository at this point in the history
* Add clipFrom when moving from preview to allow_all

* Keep minimum of minDurationForPlaybackInSec when starting DVR
  • Loading branch information
david-winder-kaltura authored Jun 11, 2019
1 parent 3628b9e commit ea89164
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/entry/LiveEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ LiveEntry.prototype.entryObjectUpdated = function(entry)
&& origViewMode != kalturaTypes.KalturaViewMode.ALLOW_ALL)
{
this._startDVR(entry);
this._setClipFrom((entry.updatedAt - config.get('minDurationForPlaybackInSec')) * 1000, false);
this._removeClipTo().then (()=>{this._updateIsPlayableUser(true)});
}
if (entry.viewMode == kalturaTypes.KalturaViewMode.PREVIEW
Expand Down Expand Up @@ -342,6 +343,11 @@ LiveEntry.prototype._startDVR = function(entry)
this.playlistGenerator.setDVRDuration(newPlayWindow);
}

LiveEntry.prototype._setClipFrom = function(clipToTimeMs, overrideExist = true)
{
this.playlistGenerator.setClipFrom(clipToTimeMs, overrideExist);
}

LiveEntry.prototype._setClipTo = function(clipToTimeMs)
{
this.playlistGenerator.setClipTo(clipToTimeMs);
Expand Down
11 changes: 11 additions & 0 deletions lib/playlistGenerator/PlaylistGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ PlaylistGenerator.prototype.setClipTo = function(clipTo) {
this.isDirty = true;
}

PlaylistGenerator.prototype.setClipFrom = function(clipFrom, overrideExist = true) {
if (clipFrom) {
if (overrideExist || !this.playlistImp.inner.clipFrom) {
this.playlistImp.inner.clipFrom = clipFrom;
}
} else {
delete this.playlistImp.inner.clipFrom;
}
this.isDirty = true;
}

var removeFile = function (pathToDelete) {
var that = this;

Expand Down

0 comments on commit ea89164

Please sign in to comment.