define('application/components/players/recording', [
'application/components/players/vod',
'application/decorators/player/interfaces/playerinterface',
'application/helpers/playerproperties',
'application/helpers/drmconfig',
'application/views/player/vod',
'rofl/lib/utils',
'application/utils',
'application/managers/api',
'application/constants'
], function (
VodComponent,
AppCorePlaybackInterface,
PlayerProperties,
DRMConfig,
VODView,
Utils,
AppUtils,
ApiManager
) {
'use strict';
var api = ApiManager.getKPNAPI();
return VodComponent.extend({
/**
* Requests the content's stream data.
*
* @param {Object} playbackData - The playback data needed to request the stream.
* @returns {Object} - Stream data.
*/
_requestStream: function (playbackData) {
var program = playbackData && playbackData.data || this._program;
return api.read('streams/recording', {
params: playbackData,
withCredentials: true,
headers: this.getStreamHeaders(program)
});
},
/**
* Sets the given program.
*
* @param {Object} program - The program to set.
* @private
*/
_setProgram: function (program) {
var duration = program.getRecordingDuration();
this._program = program;
this._startTime = this._bookmarkTime || program.getStreamOffset() || 0;
this._endTime = new Date(program.getEndTime() * 1000);
this._contentId = program.getRecordingId();
this._type = AppUtils.getContentVideoType(program.getContentType(), program.getContentSubtype());
this._view.setProgramInfoButton(program.getDetailsAction());
this._view.setNextEpisodeButton(false);
this._view.setProgram(program);
this._setProgress({
duration: duration,
currentTime: this._startTime,
percentage: (this._startTime / duration) * 100
});
this._buildSeeker();
}
});
});