define('application/decorators/player/promointerface', [
'application/decorators/player/interfaces/playerinterface',
'rofl/lib/utils',
'rofl/class',
'rofl/devices/mediaplayer/mediaplayer',
'antie/runtimecontext'
], function (
AppcorePlaybackInterface,
Utils,
Class,
MediaPlayer,
RuntimeContext
) {
'use strict';
var device = RuntimeContext.getCurrentApplication().getDevice(),
mediaplayer = device.getMediaPlayer();
return AppcorePlaybackInterface.extend({
/**
* Attepmts to play the given player properties from media source.
*
* @param {Object} playerProperties - Contains player properties such as source..
*/
play: function (playerProperties) {
var mediaSource = this.mediaSource;
if (playerProperties.source !== this.source) {
// Source has changed since las time, there's another source coming up so discard playback.
return;
}
if (!mediaSource) {
throw 'MediaSource missing from player';
}
if (!this.isPlaying()) {
// Dirt yuck yuck because Samsung.
if (mediaplayer.getState() !== 'BUFFERING') {
mediaplayer.beginLivePlayback();
}
}
}
});
});