text: "use strict";define("audioCommon/mixins/audioPlayerStates",[],function(){return{WAITING:"waiting",PAUSING:"pausing",PLAYING:"playing",REPEAT:"repeat"}}),define("audioCommon/mixins/audioMixin",["lodash","utils","santaProps","audioCommon/mixins/audioPlayerStates"],function(i,o,t,e){var a=t.Types;return{propTypes:{isPlaying:a.Audio.isPlaying,isSoundManagerOnResetup:a.Audio.isSoundManagerOnResetup,soundManagerReady:a.Audio.soundManagerReady,createAudioObj:a.Audio.createAudioObj,updatePlayingComp:a.Audio.updatePlayingComp,updatePausingComp:a.Audio.updatePausingComp,onHTML5ErrorTryToReloadWithFlash:a.Audio.onHTML5ErrorTryToReloadWithFlash,isPlayingAllowed:a.RenderFlags.isPlayingAllowed,compData:a.Component.compData.isRequired,id:a.Component.id.isRequired,serviceTopology:a.ServiceTopology.serviceTopology,isMobileView:a.isMobileView},getInitialState:function(){return this.audioObj=null,this.isAudioPlaying=!1,this.trackPosition=0,this.isPlayingAllowed=this.props.isPlayingAllowed,null},componentWillReceiveProps:function(i){this.props.compData.uri!==i.compData.uri&&this.clearAudioObject(),i.isPlaying?this.setState({$playerState:e.PLAYING}):this.props.isPlaying&&this.setState({$playerState:e.PAUSING})},componentDidUpdate:function(){"mobile"!==this.getDeviceState()&&this.props.isPlayingAllowed?this.props.isPlayingAllowed!==this.isPlayingAllowed&&(this.isPlayingAllowed=this.props.isPlayingAllowed,this.autoPlay&&this.initiatePlay()):(this.isPlayingAllowed=this.props.isPlayingAllowed,!this.isPlayingAllowed&&this.props.isPlaying&&this.initiatePause())},componentDidMount:function(){"mobile"!==this.getDeviceState()&&this.autoPlay&&this.isPlayingAllowed&&this.initiatePlay()},componentWillUnmount:function(){this.isAudioPlaying&&this.state.$playerState===e.PLAYING&&this.initiatePause(),this.clearAudioObject(),this.initiatePause()},getOrCreateAudioObject:function(){return this.audioObj||this.createAudioObject()},createAudioObject:function(){var i=this;if(!i.props.compData.uri)return!1;var o={id:i.props.id,url:i.props.serviceTopology.staticAudioUrl+"/"+i.props.compData.uri,autoPlay:!1,stream:!0,multiShot:!0,multiShotEvents:!0,autoLoad:!i.props.isMobileView||!i.props.isPlayingAllowed,usePolicyFile:!1,whileloading:function(){"function"==typeof i.whileLoadingHandler&&i.whileLoadingHandler(this.duration)},onfailure:function(){i.failedToLoadAudioFile()},onfinish:function(){i.finishedPlayingAudio(this.id)},onsuspend:function(){i.audioLoadingSuspended(this.id)},onload:function(o){o||i.props.onHTML5ErrorTryToReloadWithFlash()}};return i.props.createAudioObj(o)},clearAudioObject:function(){this.audioObj&&(i.isFunction(this.audioObj.pause)&&this.audioObj.pause(),this.audioObj=null,this.trackPosition=0,this.resetTrackPosition&&this.resetTrackPosition())},failedToLoadAudioFile:function(i){var t="Failed to load audio file "+i;o.log.verbose("%c"+t,"color: #ff9494; font-size: 24px;"),o.log.error(t)},audioLoadingSuspended:function(i){var t="Browser has chosen to stop downloading audio file "+i;o.log.verbose("%c"+t,"color: #ff9494; font-size: 24px;")},playAudio:function(){var i=this,o={volume:i.audioVolume,position:i.trackPosition,whileplaying:function(){i.trackPosition=this.position,"function"==typeof i.whilePlayingHandler&&i.whilePlayingHandler(this.position)}};this.setVolume(this.audioVolume),this.audioObj.play(o)},updateAudioObject:function(){this.audioObj=this.getOrCreateAudioObject(),this.props.isSoundManagerOnResetup&&(this.audioObj=null),this.audioObj&&(this.isAudioPlaying||this.state.$playerState!==e.PLAYING?this.isAudioPlaying&&this.state.$playerState===e.PAUSING?(this.isAudioPlaying=!1,this.audioObj.pause()):this.state.$playerState===e.REPEAT&&(this.isAudioPlaying=!1):(this.isAudioPlaying=!0,this.playAudio()))},getDeviceState:function(){return this.props.isMobileView?"mobile":"desktop"},initiatePlay:function(){i.isEmpty(this.props.compData.uri)||""===this.props.compData.uri||this.props.updatePlayingComp(this)},initiatePause:function(){this.props.updatePausingComp()},getAudioDuration:function(){return this.audioObj.duration},seekAudio:function(i){this.trackPosition=i,this.isAudioPlaying?this.audioObj.setPosition(i):this.initiatePlay()},setVolume:function(i){this.audioVolume=i,this.isAudioPlaying&&this.audioObj.setVolume(i)},muteAudio:function(){this.audioObj.mute()},unmuteAudio:function(){this.audioObj.unmute()}}}),define("audioCommon",["audioCommon/mixins/audioMixin","audioCommon/mixins/audioPlayerStates"],function(i,o){return{audioMixin:i,audioPlayerStates:o}});
  //# sourceMappingURL=audioCommon.min.js.map