|
Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT SERVER-PC 10.0 build 26200 (Windows 11) AMD64 User : ServerPC ( 0) PHP Version : 8.2.12 Disable Function : NONE Directory : C:/Users/ServerPC/AppData/Roaming/Emby-Server/system/dashboard-ui/modules/externalplayer/ |
Upload File : |
define(["exports","./../common/servicelocator.js","./../common/pluginmanager.js","./../common/appsettings.js","./../emby-apiclient/events.js"],function(_exports,_servicelocator,_pluginmanager,_appsettings,_events){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=function(){var currentSrc,self=this;function getPlayer(options){var streamInfo=Object.assign({},options);return options.mediaSource&&(streamInfo.container=options.mediaSource.Container,streamInfo.protocol=options.mediaSource.Protocol,streamInfo.video3DFormat=options.mediaSource.Video3DFormat),options.item&&(streamInfo.gameSystem=options.item.GameSystemId||options.item.GameSystem),JSON.parse(_appsettings.default.get("externalplayers")||"[]").filter(function(player){return function(player,options){if(!_servicelocator.shell.canExec)return!1;if(player.mediaType!==options.mediaType)return!1;if("Game"===options.mediaType)return(player.gameSystem||"").toString()===(options.gameSystem||"").toString();if(function(options){var filters=[];if("Video"===options.mediaType){switch((options.container||"").toLowerCase()){case"iso":case"blurayiso":case"dvdiso":filters.push("videotype-iso");break;case"dvd":filters.push("videotype-dvd");break;case"bluray":filters.push("videotype-bluray")}filters.length||("File"!==options.protocol?filters.push("videotype-stream"):filters.push("videotype-file"))}return filters}(options).filter(function(typeFilter){return!1===player[typeFilter]}).length)return!1;return!("Video"===options.mediaType&&!0===player["videotype-3d"]&&!options.video3DFormat)}(player,streamInfo)})[0]}function replaceArg(str,arg,value){return function(str,strReplace,strWith){return strReplace=strReplace.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),strReplace=new RegExp(strReplace,"ig"),str.replace(strReplace,strWith)}(str,arg,value)}function modifyStreamUrl(options){var mediaSource,method,url=options.url;return url?(mediaSource=options.mediaSource)&&"File"===mediaSource.Protocol&&url!==mediaSource.Path?(method="bluray"===mediaSource.Container||"dvd"===mediaSource.Container?"directoryExists":"fileExists",new Promise(function(resolve,reject){require(["filesystem"],resolve)}).then(function(fileSystem){return fileSystem[method](mediaSource.Path).then(function(){return mediaSource.Path},function(){return url})})):Promise.resolve(url):Promise.resolve(options.item.Path)}function closePlayer(){return Promise.resolve()}function onEnded(){onEndedInternal(!null)}function onEndedInternal(triggerEnded){triggerEnded&&(triggerEnded={src:currentSrc},_events.default.trigger(self,"stopped",[triggerEnded])),currentSrc=null}self.name="External Player",self.type="mediaplayer",self.id="externalplayer",self.priority=-10,self.supportsProgress=!1,self.isLocalPlayer=!0,self.isExternalPlayer=!0,self.canPlayMediaType=function(mediaType){return!0},self.canPlayItem=function(item,playOptions){return!!playOptions.fullscreen&&null!=getPlayer({mediaType:item.MediaType,container:item.Container,gameSystem:item.GameSystemId||item.GameSystem,protocol:"Remote"!==item.LocationType&&"Virtual"!==item.LocationType&&item.Path?"File":"Http",video3DFormat:item.Video3DFormat})},self.currentSrc=function(){return currentSrc},self.play=function(options){var player=getPlayer(options),path=player.path;return modifyStreamUrl(options).then(function(streamUrl){return _servicelocator.shell.exec({path:path,arguments:function(player,streamUrl,options){var startPosMs=(options.playerStartPositionTicks||0)/1e4;return(player.arguments||[]).map(function(arg){var _options$item;return arg=replaceArg(arg,"{path}",streamUrl),arg=replaceArg(arg,"{ms}",startPosMs),arg=replaceArg(arg,"{seconds}",Math.floor(startPosMs/1e3)),arg=null!=(_options$item=options.item)&&_options$item.Name?replaceArg(arg,"{title}",options.item.Name):arg})}(player,streamUrl,options).join("|||")}).then(function(process){return process.promise.then(onEnded,onEnded),Promise.resolve()})})},self.setSubtitleStreamIndex=function(index){},self.canSetAudioStreamIndex=function(){return!1},self.setAudioStreamIndex=function(index){},self.currentTime=function(val){return null},self.duration=function(val){return null},self.stop=function(destroyPlayer,reportEnded){return closePlayer().then(function(){return onEndedInternal(reportEnded),Promise.resolve()})},self.destroy=function(){closePlayer()},self.pause=function(){},self.unpause=function(){},self.paused=function(){return!1},self.volume=function(val){},self.setMute=function(mute){},self.isMuted=function(){},self.getTranslations=function(){return["ca","cs","de","el","en-GB","en-US","es","es-MX","fa","fi","fr","fr-CA","he","hr","hu","it","ja","kk","ko","mk","nb","nl","pl","pt-BR","pt-PT","ru","sk","sq","sv","tr","uk","vi","zh-CN","zh-HK","zh-TW"].map(function(i){return{lang:i,path:_pluginmanager.default.mapPath(self,"strings/"+i+".json")}})},self.getRoutes=function(){var routes=[];return routes.push({path:"externalplayer.html",transition:"slide",controller:"modules/externalplayer/externalplayer.js",controllerType:"module",title:"ExternalPlayer",settingsTheme:!0,adjustHeaderForEmbeddedScroll:!0}),routes.push({path:"externalplayers.html",transition:"slide",controller:"modules/externalplayer/externalplayers.js",controllerType:"module",type:"settings",title:"ExternalPlayers",category:"Playback",thumbImage:"",icon:"apps",order:1e4,settingsTheme:!0,adjustHeaderForEmbeddedScroll:!0}),routes},self.getDeviceProfile=function(item,options){var profile={};return profile.MaxStreamingBitrate=profile.MaxStaticBitrate=2e8,null!=options&&options.maxStaticMusicBitrate&&(profile.MaxStaticMusicBitrate=options.maxStaticMusicBitrate),profile.MusicStreamingTranscodingBitrate=192e3,profile.DirectPlayProfiles=[],profile.DirectPlayProfiles.push({Type:"Video"}),profile.DirectPlayProfiles.push({Type:"Audio"}),profile.TranscodingProfiles=[],profile.TranscodingProfiles.push({Container:"mkv",Type:"Video",AudioCodec:"aac,mp3,ac3",VideoCodec:"h264",Context:"Streaming"}),profile.TranscodingProfiles.push({Container:"mp3",Type:"Audio",AudioCodec:"mp3",Context:"Streaming",Protocol:"http"}),profile.ContainerProfiles=[],profile.CodecProfiles=[],profile.SubtitleProfiles=[],profile.SubtitleProfiles.push({Format:"srt",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"subrip",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"ass",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"ssa",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"dvb_teletext",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"dvb_subtitle",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"dvbsub",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"pgs",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"pgssub",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"dvdsub",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"vtt",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"sub",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"idx",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"smi",Method:"Embed"}),profile.SubtitleProfiles.push({Format:"eia_608",Method:"VideoSideData"}),profile.SubtitleProfiles.push({Format:"eia_708",Method:"VideoSideData"}),profile.ResponseProfiles=[],Promise.resolve(profile)}}});