diff --git a/dashboard-ui/bower_components/emby-apiclient/apiclient.js b/dashboard-ui/bower_components/emby-apiclient/apiclient.js index 323ec33783..3c29861ff7 100644 --- a/dashboard-ui/bower_components/emby-apiclient/apiclient.js +++ b/dashboard-ui/bower_components/emby-apiclient/apiclient.js @@ -1,2 +1,2 @@ -define(["events"],function(events){"use strict";function redetectBitrate(instance){stopBitrateDetection(instance),instance.accessToken()&&instance.enableAutomaticBitrateDetection!==!1&&setTimeout(redetectBitrateInternal.bind(instance),6e3)}function redetectBitrateInternal(){this.accessToken()&&this.detectBitrate()}function stopBitrateDetection(instance){instance.detectTimeout&&clearTimeout(instance.detectTimeout)}function replaceAll(originalString,strReplace,strWith){var reg=new RegExp(strReplace,"ig");return originalString.replace(reg,strWith)}function onFetchFail(instance,url,response){events.trigger(instance,"requestfail",[{url:url,status:response.status,errorCode:response.headers?response.headers.get("X-Application-Error-Code"):null}])}function paramsToString(params){var values=[];for(var key in params){var value=params[key];null!==value&&void 0!==value&&""!==value&&values.push(encodeURIComponent(key)+"="+encodeURIComponent(value))}return values.join("&")}function fetchWithTimeout(url,options,timeoutMs){return new Promise(function(resolve,reject){var timeout=setTimeout(reject,timeoutMs);options=options||{},options.credentials="same-origin",fetch(url,options).then(function(response){clearTimeout(timeout),resolve(response)},function(error){clearTimeout(timeout),reject(error)})})}function getFetchPromise(request){var headers=request.headers||{};"json"===request.dataType&&(headers.accept="application/json");var fetchRequest={headers:headers,method:request.type,credentials:"same-origin"},contentType=request.contentType;return request.data&&("string"==typeof request.data?fetchRequest.body=request.data:(fetchRequest.body=paramsToString(request.data),contentType=contentType||"application/x-www-form-urlencoded; charset=UTF-8")),contentType&&(headers["Content-Type"]=contentType),request.timeout?fetchWithTimeout(request.url,fetchRequest,request.timeout):fetch(request.url,fetchRequest)}function ApiClient(serverAddress,appName,appVersion,deviceName,deviceId,devicePixelRatio){if(!serverAddress)throw new Error("Must supply a serverAddress");console.log("ApiClient serverAddress: "+serverAddress),console.log("ApiClient appName: "+appName),console.log("ApiClient appVersion: "+appVersion),console.log("ApiClient deviceName: "+deviceName),console.log("ApiClient deviceId: "+deviceId),this._serverInfo={},this._serverAddress=serverAddress,this._deviceId=deviceId,this._deviceName=deviceName,this._appName=appName,this._appVersion=appVersion}function switchConnectionMode(instance,connectionMode){var currentServerInfo=instance.serverInfo(),newConnectionMode=connectionMode;return newConnectionMode--,newConnectionMode<0&&(newConnectionMode=MediaBrowser.ConnectionMode.Manual),MediaBrowser.ServerInfo.getServerAddress(currentServerInfo,newConnectionMode)?newConnectionMode:(newConnectionMode--,newConnectionMode<0&&(newConnectionMode=MediaBrowser.ConnectionMode.Manual),MediaBrowser.ServerInfo.getServerAddress(currentServerInfo,newConnectionMode)?newConnectionMode:connectionMode)}function tryReconnectInternal(instance,resolve,reject,connectionMode,currentRetryCount){connectionMode=switchConnectionMode(instance,connectionMode);var url=MediaBrowser.ServerInfo.getServerAddress(instance.serverInfo(),connectionMode);console.log("Attempting reconnection to "+url);var timeout=connectionMode===MediaBrowser.ConnectionMode.Local?7e3:15e3;fetchWithTimeout(url+"/system/info/public",{method:"GET",accept:"application/json"},timeout).then(function(){console.log("Reconnect succeeded to "+url),instance.serverInfo().LastConnectionMode=connectionMode,instance.serverAddress(url),resolve()},function(){if(console.log("Reconnect attempt failed to "+url),currentRetryCount<5){var newConnectionMode=switchConnectionMode(instance,connectionMode);setTimeout(function(){tryReconnectInternal(instance,resolve,reject,newConnectionMode,currentRetryCount+1)},300)}else reject()})}function tryReconnect(instance){return new Promise(function(resolve,reject){setTimeout(function(){tryReconnectInternal(instance,resolve,reject,instance.serverInfo().LastConnectionMode,0)},300)})}function onWebSocketMessage(instance,msg){if("UserDeleted"===msg.MessageType)instance._currentUser=null;else if("UserUpdated"===msg.MessageType||"UserConfigurationUpdated"===msg.MessageType){var user=msg.Data;user.Id===instance.getCurrentUserId()&&(instance._currentUser=null)}events.trigger(instance,"websocketmessage",[msg])}function normalizeReturnBitrate(instance,bitrate){if(!bitrate)return instance.lastDetectedBitrate?instance.lastDetectedBitrate:Promise.reject();var result=Math.round(.8*bitrate);return instance.lastDetectedBitrate=result,instance.lastDetectedBitrateTime=(new Date).getTime(),result}function detectBitrateInternal(instance,tests,index,currentBitrate){if(index>=tests.length)return normalizeReturnBitrate(instance,currentBitrate);var test=tests[index];return instance.getDownloadSpeed(test.bytes).then(function(bitrate){return bitrate1800?this.ajax({type:"POST",url:this.getUrl("LiveTv/Programs"),data:JSON.stringify(options),contentType:"application/json",dataType:"json"}):this.ajax({type:"GET",url:this.getUrl("LiveTv/Programs",options),dataType:"json"})},ApiClient.prototype.getLiveTvRecommendedPrograms=function(options){return options=options||{},this.ajax({type:"GET",url:this.getUrl("LiveTv/Programs/Recommended",options),dataType:"json"})},ApiClient.prototype.getLiveTvRecordings=function(options){var url=this.getUrl("LiveTv/Recordings",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvRecordingSeries=function(options){var url=this.getUrl("LiveTv/Recordings/Series",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvRecordingGroups=function(options){var url=this.getUrl("LiveTv/Recordings/Groups",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvRecordingGroup=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Recordings/Groups/"+id);return this.getJSON(url)},ApiClient.prototype.getLiveTvRecording=function(id,userId){if(!id)throw new Error("null id");var options={};userId&&(options.userId=userId);var url=this.getUrl("LiveTv/Recordings/"+id,options);return this.getJSON(url)},ApiClient.prototype.getLiveTvProgram=function(id,userId){if(!id)throw new Error("null id");var options={};userId&&(options.userId=userId);var url=this.getUrl("LiveTv/Programs/"+id,options);return this.getJSON(url)},ApiClient.prototype.deleteLiveTvRecording=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Recordings/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.cancelLiveTvTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Timers/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.getLiveTvTimers=function(options){var url=this.getUrl("LiveTv/Timers",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Timers/"+id);return this.getJSON(url)},ApiClient.prototype.getNewLiveTvTimerDefaults=function(options){options=options||{};var url=this.getUrl("LiveTv/Timers/Defaults",options);return this.getJSON(url)},ApiClient.prototype.createLiveTvTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/Timers");return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.updateLiveTvTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/Timers/"+item.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.resetLiveTvTuner=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Tuners/"+id+"/Reset");return this.ajax({type:"POST",url:url})},ApiClient.prototype.getLiveTvSeriesTimers=function(options){var url=this.getUrl("LiveTv/SeriesTimers",options||{});return this.getJSON(url)},ApiClient.prototype.getFileOrganizationResults=function(options){var url=this.getUrl("Library/FileOrganization",options||{});return this.getJSON(url)},ApiClient.prototype.deleteOriginalFileFromOrganizationResult=function(id){var url=this.getUrl("Library/FileOrganizations/"+id+"/File");return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.clearOrganizationLog=function(){var url=this.getUrl("Library/FileOrganizations");return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.performOrganization=function(id){var url=this.getUrl("Library/FileOrganizations/"+id+"/Organize");return this.ajax({type:"POST",url:url})},ApiClient.prototype.performEpisodeOrganization=function(id,options){var url=this.getUrl("Library/FileOrganizations/"+id+"/Episode/Organize");return this.ajax({type:"POST",url:url,data:JSON.stringify(options),contentType:"application/json"})},ApiClient.prototype.getLiveTvSeriesTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/SeriesTimers/"+id);return this.getJSON(url)},ApiClient.prototype.cancelLiveTvSeriesTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/SeriesTimers/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.createLiveTvSeriesTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/SeriesTimers");return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.updateLiveTvSeriesTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/SeriesTimers/"+item.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.getRegistrationInfo=function(feature){var url=this.getUrl("Registrations/"+feature);return this.getJSON(url)},ApiClient.prototype.getSystemInfo=function(){var url=this.getUrl("System/Info");return this.getJSON(url)},ApiClient.prototype.getPublicSystemInfo=function(){var url=this.getUrl("System/Info/Public");return this.getJSON(url,!1)},ApiClient.prototype.getInstantMixFromItem=function(itemId,options){var url=this.getUrl("Items/"+itemId+"/InstantMix",options);return this.getJSON(url)},ApiClient.prototype.getEpisodes=function(itemId,options){var url=this.getUrl("Shows/"+itemId+"/Episodes",options);return this.getJSON(url)},ApiClient.prototype.getDisplayPreferences=function(id,userId,app){var url=this.getUrl("DisplayPreferences/"+id,{userId:userId,client:app});return this.getJSON(url)},ApiClient.prototype.updateDisplayPreferences=function(id,obj,userId,app){var url=this.getUrl("DisplayPreferences/"+id,{userId:userId,client:app});return this.ajax({type:"POST",url:url,data:JSON.stringify(obj),contentType:"application/json"})},ApiClient.prototype.getSeasons=function(itemId,options){var url=this.getUrl("Shows/"+itemId+"/Seasons",options);return this.getJSON(url)},ApiClient.prototype.getSimilarItems=function(itemId,options){var url=this.getUrl("Items/"+itemId+"/Similar",options);return this.getJSON(url)},ApiClient.prototype.getCultures=function(){var url=this.getUrl("Localization/cultures");return this.getJSON(url)},ApiClient.prototype.getCountries=function(){var url=this.getUrl("Localization/countries");return this.getJSON(url)},ApiClient.prototype.getPluginSecurityInfo=function(){var url=this.getUrl("Plugins/SecurityInfo");return this.getJSON(url)},ApiClient.prototype.getPlaybackInfo=function(itemId,options,deviceProfile){var postData={DeviceProfile:deviceProfile};return this.ajax({url:this.getUrl("Items/"+itemId+"/PlaybackInfo",options),type:"POST",data:JSON.stringify(postData),contentType:"application/json",dataType:"json"})},ApiClient.prototype.getIntros=function(itemId){return this.getJSON(this.getUrl("Users/"+this.getCurrentUserId()+"/Items/"+itemId+"/Intros"))},ApiClient.prototype.getDirectoryContents=function(path,options){if(!path)throw new Error("null path");if("string"!=typeof path)throw new Error("invalid path");options=options||{},options.path=path;var url=this.getUrl("Environment/DirectoryContents",options);return this.getJSON(url)},ApiClient.prototype.getNetworkShares=function(path){if(!path)throw new Error("null path");var options={};options.path=path;var url=this.getUrl("Environment/NetworkShares",options);return this.getJSON(url)},ApiClient.prototype.getParentPath=function(path){if(!path)throw new Error("null path");var options={};options.path=path;var url=this.getUrl("Environment/ParentPath",options);return this.ajax({type:"GET",url:url,dataType:"text"})},ApiClient.prototype.getDrives=function(){var url=this.getUrl("Environment/Drives");return this.getJSON(url)},ApiClient.prototype.getNetworkDevices=function(){var url=this.getUrl("Environment/NetworkDevices");return this.getJSON(url)},ApiClient.prototype.cancelPackageInstallation=function(installationId){if(!installationId)throw new Error("null installationId");var url=this.getUrl("Packages/Installing/"+installationId);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.refreshItem=function(itemId,options){if(!itemId)throw new Error("null itemId");var url=this.getUrl("Items/"+itemId+"/Refresh",options||{});return this.ajax({type:"POST",url:url})},ApiClient.prototype.installPlugin=function(name,guid,updateClass,version){if(!name)throw new Error("null name");if(!updateClass)throw new Error("null updateClass");var options={updateClass:updateClass,AssemblyGuid:guid};version&&(options.version=version);var url=this.getUrl("Packages/Installed/"+name,options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.restartServer=function(){var url=this.getUrl("System/Restart");return this.ajax({type:"POST",url:url})},ApiClient.prototype.shutdownServer=function(){var url=this.getUrl("System/Shutdown");return this.ajax({type:"POST",url:url})},ApiClient.prototype.getPackageInfo=function(name,guid){if(!name)throw new Error("null name");var options={AssemblyGuid:guid},url=this.getUrl("Packages/"+name,options);return this.getJSON(url)},ApiClient.prototype.getAvailableApplicationUpdate=function(){var url=this.getUrl("Packages/Updates",{PackageType:"System"});return this.getJSON(url)},ApiClient.prototype.getAvailablePluginUpdates=function(){var url=this.getUrl("Packages/Updates",{PackageType:"UserInstalled"});return this.getJSON(url)},ApiClient.prototype.getVirtualFolders=function(){var url="Library/VirtualFolders";return url=this.getUrl(url),this.getJSON(url)},ApiClient.prototype.getPhysicalPaths=function(){var url=this.getUrl("Library/PhysicalPaths");return this.getJSON(url)},ApiClient.prototype.getServerConfiguration=function(){var url=this.getUrl("System/Configuration");return this.getJSON(url)},ApiClient.prototype.getDevicesOptions=function(){var url=this.getUrl("System/Configuration/devices");return this.getJSON(url)},ApiClient.prototype.getContentUploadHistory=function(){var url=this.getUrl("Devices/CameraUploads",{DeviceId:this.deviceId()});return this.getJSON(url)},ApiClient.prototype.getNamedConfiguration=function(name){var url=this.getUrl("System/Configuration/"+name);return this.getJSON(url)},ApiClient.prototype.getScheduledTasks=function(options){options=options||{};var url=this.getUrl("ScheduledTasks",options);return this.getJSON(url)},ApiClient.prototype.startScheduledTask=function(id){if(!id)throw new Error("null id");var url=this.getUrl("ScheduledTasks/Running/"+id);return this.ajax({type:"POST",url:url})},ApiClient.prototype.getScheduledTask=function(id){if(!id)throw new Error("null id");var url=this.getUrl("ScheduledTasks/"+id);return this.getJSON(url)},ApiClient.prototype.getNextUpEpisodes=function(options){var url=this.getUrl("Shows/NextUp",options);return this.getJSON(url)},ApiClient.prototype.stopScheduledTask=function(id){if(!id)throw new Error("null id");var url=this.getUrl("ScheduledTasks/Running/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.getPluginConfiguration=function(id){if(!id)throw new Error("null Id");var url=this.getUrl("Plugins/"+id+"/Configuration");return this.getJSON(url)},ApiClient.prototype.getAvailablePlugins=function(options){options=options||{},options.PackageType="UserInstalled";var url=this.getUrl("Packages",options);return this.getJSON(url)},ApiClient.prototype.uninstallPlugin=function(id){if(!id)throw new Error("null Id");var url=this.getUrl("Plugins/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.removeVirtualFolder=function(name,refreshLibrary){if(!name)throw new Error("null name");var url="Library/VirtualFolders";return url=this.getUrl(url,{refreshLibrary:!!refreshLibrary,name:name}),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.addVirtualFolder=function(name,type,refreshLibrary,libraryOptions){if(!name)throw new Error("null name");var options={};type&&(options.collectionType=type),options.refreshLibrary=!!refreshLibrary,options.name=name;var url="Library/VirtualFolders";return url=this.getUrl(url,options),this.ajax({type:"POST",url:url,data:JSON.stringify({LibraryOptions:libraryOptions}),contentType:"application/json"})},ApiClient.prototype.updateVirtualFolderOptions=function(id,libraryOptions){if(!id)throw new Error("null name");var url="Library/VirtualFolders/LibraryOptions";return url=this.getUrl(url),this.ajax({type:"POST",url:url,data:JSON.stringify({Id:id,LibraryOptions:libraryOptions}),contentType:"application/json"})},ApiClient.prototype.renameVirtualFolder=function(name,newName,refreshLibrary){if(!name)throw new Error("null name");var url="Library/VirtualFolders/Name";return url=this.getUrl(url,{refreshLibrary:!!refreshLibrary,newName:newName,name:name}),this.ajax({type:"POST",url:url})},ApiClient.prototype.addMediaPath=function(virtualFolderName,mediaPath,networkSharePath,refreshLibrary){if(!virtualFolderName)throw new Error("null virtualFolderName");if(!mediaPath)throw new Error("null mediaPath");var url="Library/VirtualFolders/Paths",pathInfo={Path:mediaPath};return networkSharePath&&(pathInfo.NetworkPath=networkSharePath),url=this.getUrl(url,{refreshLibrary:!!refreshLibrary}),this.ajax({type:"POST",url:url,data:JSON.stringify({Name:virtualFolderName,PathInfo:pathInfo}),contentType:"application/json"})},ApiClient.prototype.updateMediaPath=function(virtualFolderName,pathInfo){if(!virtualFolderName)throw new Error("null virtualFolderName"); -if(!pathInfo)throw new Error("null pathInfo");var url="Library/VirtualFolders/Paths/Update";return url=this.getUrl(url),this.ajax({type:"POST",url:url,data:JSON.stringify({Name:virtualFolderName,PathInfo:pathInfo}),contentType:"application/json"})},ApiClient.prototype.removeMediaPath=function(virtualFolderName,mediaPath,refreshLibrary){if(!virtualFolderName)throw new Error("null virtualFolderName");if(!mediaPath)throw new Error("null mediaPath");var url="Library/VirtualFolders/Paths";return url=this.getUrl(url,{refreshLibrary:!!refreshLibrary,path:mediaPath,name:virtualFolderName}),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteUser=function(id){if(!id)throw new Error("null id");var url=this.getUrl("Users/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteUserImage=function(userId,imageType,imageIndex){if(!userId)throw new Error("null userId");if(!imageType)throw new Error("null imageType");var url=this.getUrl("Users/"+userId+"/Images/"+imageType);return null!=imageIndex&&(url+="/"+imageIndex),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteItemImage=function(itemId,imageType,imageIndex){if(!imageType)throw new Error("null imageType");var url=this.getUrl("Items/"+itemId+"/Images");return url+="/"+imageType,null!=imageIndex&&(url+="/"+imageIndex),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteItem=function(itemId){if(!itemId)throw new Error("null itemId");var url=this.getUrl("Items/"+itemId);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.stopActiveEncodings=function(playSessionId){var options={deviceId:this.deviceId()};playSessionId&&(options.PlaySessionId=playSessionId);var url=this.getUrl("Videos/ActiveEncodings",options);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.reportCapabilities=function(options){var url=this.getUrl("Sessions/Capabilities/Full");return this.ajax({type:"POST",url:url,data:JSON.stringify(options),contentType:"application/json"})},ApiClient.prototype.updateItemImageIndex=function(itemId,imageType,imageIndex,newIndex){if(!imageType)throw new Error("null imageType");var options={newIndex:newIndex},url=this.getUrl("Items/"+itemId+"/Images/"+imageType+"/"+imageIndex+"/Index",options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.getItemImageInfos=function(itemId){var url=this.getUrl("Items/"+itemId+"/Images");return this.getJSON(url)},ApiClient.prototype.getCriticReviews=function(itemId,options){if(!itemId)throw new Error("null itemId");var url=this.getUrl("Items/"+itemId+"/CriticReviews",options);return this.getJSON(url)},ApiClient.prototype.getItemDownloadUrl=function(itemId){if(!itemId)throw new Error("itemId cannot be empty");var url="Items/"+itemId+"/Download";return this.getUrl(url,{api_key:this.accessToken()})},ApiClient.prototype.getSessions=function(options){var url=this.getUrl("Sessions",options);return this.getJSON(url)},ApiClient.prototype.uploadUserImage=function(userId,imageType,file){if(!userId)throw new Error("null userId");if(!imageType)throw new Error("null imageType");if(!file)throw new Error("File must be an image.");if("image/png"!==file.type&&"image/jpeg"!==file.type&&"image/jpeg"!==file.type)throw new Error("File must be an image.");var instance=this;return new Promise(function(resolve,reject){var reader=new FileReader;reader.onerror=function(){reject()},reader.onabort=function(){reject()},reader.onload=function(e){var data=e.target.result.split(",")[1],url=instance.getUrl("Users/"+userId+"/Images/"+imageType);instance.ajax({type:"POST",url:url,data:data,contentType:"image/"+file.name.substring(file.name.lastIndexOf(".")+1)}).then(resolve,reject)},reader.readAsDataURL(file)})},ApiClient.prototype.uploadItemImage=function(itemId,imageType,file){if(!itemId)throw new Error("null itemId");if(!imageType)throw new Error("null imageType");if(!file)throw new Error("File must be an image.");if("image/png"!==file.type&&"image/jpeg"!==file.type&&"image/jpeg"!==file.type)throw new Error("File must be an image.");var url=this.getUrl("Items/"+itemId+"/Images");url+="/"+imageType;var instance=this;return new Promise(function(resolve,reject){var reader=new FileReader;reader.onerror=function(){reject()},reader.onabort=function(){reject()},reader.onload=function(e){var data=e.target.result.split(",")[1];instance.ajax({type:"POST",url:url,data:data,contentType:"image/"+file.name.substring(file.name.lastIndexOf(".")+1)}).then(resolve,reject)},reader.readAsDataURL(file)})},ApiClient.prototype.getInstalledPlugins=function(){var options={},url=this.getUrl("Plugins",options);return this.getJSON(url)},ApiClient.prototype.getUser=function(id){if(!id)throw new Error("Must supply a userId");var url=this.getUrl("Users/"+id);return this.getJSON(url)},ApiClient.prototype.getStudio=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Studios/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getGenre=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Genres/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getMusicGenre=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("MusicGenres/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getGameGenre=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("GameGenres/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getArtist=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Artists/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getPerson=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Persons/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getPublicUsers=function(){var url=this.getUrl("users/public");return this.ajax({type:"GET",url:url,dataType:"json"},!1)},ApiClient.prototype.getUsers=function(options){var url=this.getUrl("users",options||{});return this.getJSON(url)},ApiClient.prototype.getParentalRatings=function(){var url=this.getUrl("Localization/ParentalRatings");return this.getJSON(url)},ApiClient.prototype.getDefaultImageQuality=function(imageType){return"backdrop"===imageType.toLowerCase()?80:90},ApiClient.prototype.getUserImageUrl=function(userId,options){if(!userId)throw new Error("null userId");options=options||{};var url="Users/"+userId+"/Images/"+options.type;return null!=options.index&&(url+="/"+options.index),normalizeImageOptions(this,options),delete options.type,delete options.index,this.getUrl(url,options)},ApiClient.prototype.getImageUrl=function(itemId,options){if(!itemId)throw new Error("itemId cannot be empty");options=options||{};var url="Items/"+itemId+"/Images/"+options.type;return null!=options.index&&(url+="/"+options.index),options.quality=options.quality||this.getDefaultImageQuality(options.type),this.normalizeImageOptions&&this.normalizeImageOptions(options),delete options.type,delete options.index,this.getUrl(url,options)},ApiClient.prototype.getScaledImageUrl=function(itemId,options){if(!itemId)throw new Error("itemId cannot be empty");options=options||{};var url="Items/"+itemId+"/Images/"+options.type;return null!=options.index&&(url+="/"+options.index),normalizeImageOptions(this,options),delete options.type,delete options.index,delete options.minScale,this.getUrl(url,options)},ApiClient.prototype.getThumbImageUrl=function(item,options){if(!item)throw new Error("null item");return options=options||{},options.imageType="thumb",item.ImageTags&&item.ImageTags.Thumb?(options.tag=item.ImageTags.Thumb,this.getImageUrl(item.Id,options)):item.ParentThumbItemId?(options.tag=item.ImageTags.ParentThumbImageTag,this.getImageUrl(item.ParentThumbItemId,options)):null},ApiClient.prototype.updateUserPassword=function(userId,currentPassword,newPassword){if(!userId)return Promise.reject();var url=this.getUrl("Users/"+userId+"/Password"),instance=this;return new Promise(function(resolve,reject){require(["cryptojs-sha1"],function(){instance.ajax({type:"POST",url:url,data:{currentPassword:CryptoJS.SHA1(currentPassword).toString(),newPassword:CryptoJS.SHA1(newPassword).toString()}}).then(resolve,reject)})})},ApiClient.prototype.updateEasyPassword=function(userId,newPassword){var instance=this;return new Promise(function(resolve,reject){if(!userId)return void reject();var url=this.getUrl("Users/"+userId+"/EasyPassword");require(["cryptojs-sha1"],function(){instance.ajax({type:"POST",url:url,data:{newPassword:CryptoJS.SHA1(newPassword).toString()}}).then(resolve,reject)})})},ApiClient.prototype.resetUserPassword=function(userId){if(!userId)throw new Error("null userId");var url=this.getUrl("Users/"+userId+"/Password"),postData={};return postData.resetPassword=!0,this.ajax({type:"POST",url:url,data:postData})},ApiClient.prototype.resetEasyPassword=function(userId){if(!userId)throw new Error("null userId");var url=this.getUrl("Users/"+userId+"/EasyPassword"),postData={};return postData.resetPassword=!0,this.ajax({type:"POST",url:url,data:postData})},ApiClient.prototype.updateServerConfiguration=function(configuration){if(!configuration)throw new Error("null configuration");var url=this.getUrl("System/Configuration");return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.updateNamedConfiguration=function(name,configuration){if(!configuration)throw new Error("null configuration");var url=this.getUrl("System/Configuration/"+name);return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.updateItem=function(item){if(!item)throw new Error("null item");var url=this.getUrl("Items/"+item.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.updatePluginSecurityInfo=function(info){var url=this.getUrl("Plugins/SecurityInfo");return this.ajax({type:"POST",url:url,data:JSON.stringify(info),contentType:"application/json"})},ApiClient.prototype.createUser=function(name){var url=this.getUrl("Users/New");return this.ajax({type:"POST",url:url,data:{Name:name},dataType:"json"})},ApiClient.prototype.updateUser=function(user){if(!user)throw new Error("null user");var url=this.getUrl("Users/"+user.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(user),contentType:"application/json"})},ApiClient.prototype.updateUserPolicy=function(userId,policy){if(!userId)throw new Error("null userId");if(!policy)throw new Error("null policy");var url=this.getUrl("Users/"+userId+"/Policy");return this.ajax({type:"POST",url:url,data:JSON.stringify(policy),contentType:"application/json"})},ApiClient.prototype.updateUserConfiguration=function(userId,configuration){if(!userId)throw new Error("null userId");if(!configuration)throw new Error("null configuration");var url=this.getUrl("Users/"+userId+"/Configuration");return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.updateScheduledTaskTriggers=function(id,triggers){if(!id)throw new Error("null id");if(!triggers)throw new Error("null triggers");var url=this.getUrl("ScheduledTasks/"+id+"/Triggers");return this.ajax({type:"POST",url:url,data:JSON.stringify(triggers),contentType:"application/json"})},ApiClient.prototype.updatePluginConfiguration=function(id,configuration){if(!id)throw new Error("null Id");if(!configuration)throw new Error("null configuration");var url=this.getUrl("Plugins/"+id+"/Configuration");return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.getAncestorItems=function(itemId,userId){if(!itemId)throw new Error("null itemId");var options={};userId&&(options.userId=userId);var url=this.getUrl("Items/"+itemId+"/Ancestors",options);return this.getJSON(url)},ApiClient.prototype.getItems=function(userId,options){var url;return url="string"===(typeof userId).toString().toLowerCase()?this.getUrl("Users/"+userId+"/Items",options):this.getUrl("Items",options),this.getJSON(url)},ApiClient.prototype.getMovieRecommendations=function(options){return this.getJSON(this.getUrl("Movies/Recommendations",options))},ApiClient.prototype.getUpcomingEpisodes=function(options){return this.getJSON(this.getUrl("Shows/Upcoming",options))},ApiClient.prototype.getChannels=function(query){return this.getJSON(this.getUrl("Channels",query||{}))},ApiClient.prototype.getLatestChannelItems=function(query){return this.getJSON(this.getUrl("Channels/Items/Latest",query))},ApiClient.prototype.getUserViews=function(options,userId){options=options||{};var url=this.getUrl("Users/"+(userId||this.getCurrentUserId())+"/Views",options);return this.getJSON(url)},ApiClient.prototype.getArtists=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Artists",options);return this.getJSON(url)},ApiClient.prototype.getAlbumArtists=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Artists/AlbumArtists",options);return this.getJSON(url)},ApiClient.prototype.getGenres=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Genres",options);return this.getJSON(url)},ApiClient.prototype.getMusicGenres=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("MusicGenres",options);return this.getJSON(url)},ApiClient.prototype.getGameGenres=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("GameGenres",options);return this.getJSON(url)},ApiClient.prototype.getPeople=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Persons",options);return this.getJSON(url)},ApiClient.prototype.getStudios=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Studios",options);return this.getJSON(url)},ApiClient.prototype.getLocalTrailers=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/LocalTrailers");return this.getJSON(url)},ApiClient.prototype.getGameSystems=function(){var options={},userId=this.getCurrentUserId();userId&&(options.userId=userId);var url=this.getUrl("Games/SystemSummaries",options);return this.getJSON(url)},ApiClient.prototype.getAdditionalVideoParts=function(userId,itemId){if(!itemId)throw new Error("null itemId");var options={};userId&&(options.userId=userId);var url=this.getUrl("Videos/"+itemId+"/AdditionalParts",options);return this.getJSON(url)},ApiClient.prototype.getThemeMedia=function(userId,itemId,inherit){if(!itemId)throw new Error("null itemId");var options={};userId&&(options.userId=userId),options.InheritFromParent=inherit||!1;var url=this.getUrl("Items/"+itemId+"/ThemeMedia",options);return this.getJSON(url)},ApiClient.prototype.getSearchHints=function(options){var url=this.getUrl("Search/Hints",options),serverId=this.serverId();return this.getJSON(url).then(function(result){return result.SearchHints.forEach(function(i){i.ServerId=serverId}),result})},ApiClient.prototype.getSpecialFeatures=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/SpecialFeatures");return this.getJSON(url)},ApiClient.prototype.getDateParamValue=function(date){function formatDigit(i){return i<10?"0"+i:i}var d=date;return""+d.getFullYear()+formatDigit(d.getMonth()+1)+formatDigit(d.getDate())+formatDigit(d.getHours())+formatDigit(d.getMinutes())+formatDigit(d.getSeconds())},ApiClient.prototype.markPlayed=function(userId,itemId,date){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var options={};date&&(options.DatePlayed=this.getDateParamValue(date));var url=this.getUrl("Users/"+userId+"/PlayedItems/"+itemId,options);return this.ajax({type:"POST",url:url,dataType:"json"})},ApiClient.prototype.markUnplayed=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/PlayedItems/"+itemId);return this.ajax({type:"DELETE",url:url,dataType:"json"})},ApiClient.prototype.updateFavoriteStatus=function(userId,itemId,isFavorite){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/FavoriteItems/"+itemId),method=isFavorite?"POST":"DELETE";return this.ajax({type:method,url:url,dataType:"json"})},ApiClient.prototype.updateUserItemRating=function(userId,itemId,likes){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/Rating",{likes:likes});return this.ajax({type:"POST",url:url,dataType:"json"})},ApiClient.prototype.getItemCounts=function(userId){var options={};userId&&(options.userId=userId);var url=this.getUrl("Items/Counts",options);return this.getJSON(url)},ApiClient.prototype.clearUserItemRating=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/Rating");return this.ajax({type:"DELETE",url:url,dataType:"json"})},ApiClient.prototype.reportPlaybackStart=function(options){if(!options)throw new Error("null options");this.lastPlaybackProgressReport=0,stopBitrateDetection(this);var url=this.getUrl("Sessions/Playing");return this.ajax({type:"POST",data:JSON.stringify(options),contentType:"application/json",url:url})},ApiClient.prototype.reportPlaybackProgress=function(options){if(!options)throw new Error("null options");if("timeupdate"===(options.EventName||"timeupdate")){var now=(new Date).getTime();if(now-(this.lastPlaybackProgressReport||0)<=1e4)return;this.lastPlaybackProgressReport=now}else this.lastPlaybackProgressReport=0;var url=this.getUrl("Sessions/Playing/Progress");return this.ajax({type:"POST",data:JSON.stringify(options),contentType:"application/json",url:url})},ApiClient.prototype.reportOfflineActions=function(actions){if(!actions)throw new Error("null actions");var url=this.getUrl("Sync/OfflineActions");return this.ajax({type:"POST",data:JSON.stringify(actions),contentType:"application/json",url:url})},ApiClient.prototype.syncData=function(data){if(!data)throw new Error("null data");var url=this.getUrl("Sync/Data");return this.ajax({type:"POST",data:JSON.stringify(data),contentType:"application/json",url:url,dataType:"json"})},ApiClient.prototype.getReadySyncItems=function(deviceId){if(!deviceId)throw new Error("null deviceId");var url=this.getUrl("Sync/Items/Ready",{TargetId:deviceId});return this.getJSON(url)},ApiClient.prototype.reportSyncJobItemTransferred=function(syncJobItemId){if(!syncJobItemId)throw new Error("null syncJobItemId");var url=this.getUrl("Sync/JobItems/"+syncJobItemId+"/Transferred");return this.ajax({type:"POST",url:url})},ApiClient.prototype.cancelSyncItems=function(itemIds,targetId){if(!itemIds)throw new Error("null itemIds");var url=this.getUrl("Sync/"+(targetId||this.deviceId())+"/Items",{ItemIds:itemIds.join(",")});return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.reportPlaybackStopped=function(options){if(!options)throw new Error("null options");this.lastPlaybackProgressReport=0,redetectBitrate(this);var url=this.getUrl("Sessions/Playing/Stopped");return this.ajax({type:"POST",data:JSON.stringify(options),contentType:"application/json",url:url})},ApiClient.prototype.sendPlayCommand=function(sessionId,options){if(!sessionId)throw new Error("null sessionId");if(!options)throw new Error("null options");var url=this.getUrl("Sessions/"+sessionId+"/Playing",options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.sendCommand=function(sessionId,command){if(!sessionId)throw new Error("null sessionId");if(!command)throw new Error("null command");var url=this.getUrl("Sessions/"+sessionId+"/Command"),ajaxOptions={type:"POST",url:url};return ajaxOptions.data=JSON.stringify(command),ajaxOptions.contentType="application/json",this.ajax(ajaxOptions)},ApiClient.prototype.sendMessageCommand=function(sessionId,options){if(!sessionId)throw new Error("null sessionId");if(!options)throw new Error("null options");var url=this.getUrl("Sessions/"+sessionId+"/Message",options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.sendPlayStateCommand=function(sessionId,command,options){if(!sessionId)throw new Error("null sessionId");if(!command)throw new Error("null command");var url=this.getUrl("Sessions/"+sessionId+"/Playing/"+command,options||{});return this.ajax({type:"POST",url:url})},ApiClient.prototype.createPackageReview=function(review){var url=this.getUrl("Packages/Reviews/"+review.id,review);return this.ajax({type:"POST",url:url})},ApiClient.prototype.getPackageReviews=function(packageId,minRating,maxRating,limit){if(!packageId)throw new Error("null packageId");var options={};minRating&&(options.MinRating=minRating),maxRating&&(options.MaxRating=maxRating),limit&&(options.Limit=limit);var url=this.getUrl("Packages/"+packageId+"/Reviews",options);return this.getJSON(url)},ApiClient.prototype.getSmartMatchInfos=function(options){options=options||{};var url=this.getUrl("Library/FileOrganizations/SmartMatches",options);return this.ajax({type:"GET",url:url,dataType:"json"})},ApiClient.prototype.deleteSmartMatchEntries=function(entries){var url=this.getUrl("Library/FileOrganizations/SmartMatches/Delete"),postData={Entries:entries};return this.ajax({type:"POST",url:url,data:JSON.stringify(postData),contentType:"application/json"})},ApiClient.prototype.getEndpointInfo=function(){return this.getJSON(this.getUrl("System/Endpoint"))},ApiClient.prototype.getLatestItems=function(options){return options=options||{},this.getJSON(this.getUrl("Users/"+this.getCurrentUserId()+"/Items/Latest",options))},ApiClient}); \ No newline at end of file +define(["events"],function(events){"use strict";function redetectBitrate(instance){stopBitrateDetection(instance),instance.accessToken()&&instance.enableAutomaticBitrateDetection!==!1&&setTimeout(redetectBitrateInternal.bind(instance),6e3)}function redetectBitrateInternal(){this.accessToken()&&this.detectBitrate()}function stopBitrateDetection(instance){instance.detectTimeout&&clearTimeout(instance.detectTimeout)}function replaceAll(originalString,strReplace,strWith){var reg=new RegExp(strReplace,"ig");return originalString.replace(reg,strWith)}function onFetchFail(instance,url,response){events.trigger(instance,"requestfail",[{url:url,status:response.status,errorCode:response.headers?response.headers.get("X-Application-Error-Code"):null}])}function paramsToString(params){var values=[];for(var key in params){var value=params[key];null!==value&&void 0!==value&&""!==value&&values.push(encodeURIComponent(key)+"="+encodeURIComponent(value))}return values.join("&")}function fetchWithTimeout(url,options,timeoutMs){return new Promise(function(resolve,reject){var timeout=setTimeout(reject,timeoutMs);options=options||{},options.credentials="same-origin",fetch(url,options).then(function(response){clearTimeout(timeout),resolve(response)},function(error){clearTimeout(timeout),reject(error)})})}function getFetchPromise(request){var headers=request.headers||{};"json"===request.dataType&&(headers.accept="application/json");var fetchRequest={headers:headers,method:request.type,credentials:"same-origin"},contentType=request.contentType;return request.data&&("string"==typeof request.data?fetchRequest.body=request.data:(fetchRequest.body=paramsToString(request.data),contentType=contentType||"application/x-www-form-urlencoded; charset=UTF-8")),contentType&&(headers["Content-Type"]=contentType),request.timeout?fetchWithTimeout(request.url,fetchRequest,request.timeout):fetch(request.url,fetchRequest)}function ApiClient(serverAddress,appName,appVersion,deviceName,deviceId,devicePixelRatio){if(!serverAddress)throw new Error("Must supply a serverAddress");console.log("ApiClient serverAddress: "+serverAddress),console.log("ApiClient appName: "+appName),console.log("ApiClient appVersion: "+appVersion),console.log("ApiClient deviceName: "+deviceName),console.log("ApiClient deviceId: "+deviceId),this._serverInfo={},this._serverAddress=serverAddress,this._deviceId=deviceId,this._deviceName=deviceName,this._appName=appName,this._appVersion=appVersion,this._devicePixelRatio=devicePixelRatio}function switchConnectionMode(instance,connectionMode){var currentServerInfo=instance.serverInfo(),newConnectionMode=connectionMode;return newConnectionMode--,newConnectionMode<0&&(newConnectionMode=MediaBrowser.ConnectionMode.Manual),MediaBrowser.ServerInfo.getServerAddress(currentServerInfo,newConnectionMode)?newConnectionMode:(newConnectionMode--,newConnectionMode<0&&(newConnectionMode=MediaBrowser.ConnectionMode.Manual),MediaBrowser.ServerInfo.getServerAddress(currentServerInfo,newConnectionMode)?newConnectionMode:connectionMode)}function tryReconnectInternal(instance,resolve,reject,connectionMode,currentRetryCount){connectionMode=switchConnectionMode(instance,connectionMode);var url=MediaBrowser.ServerInfo.getServerAddress(instance.serverInfo(),connectionMode);console.log("Attempting reconnection to "+url);var timeout=connectionMode===MediaBrowser.ConnectionMode.Local?7e3:15e3;fetchWithTimeout(url+"/system/info/public",{method:"GET",accept:"application/json"},timeout).then(function(){console.log("Reconnect succeeded to "+url),instance.serverInfo().LastConnectionMode=connectionMode,instance.serverAddress(url),resolve()},function(){if(console.log("Reconnect attempt failed to "+url),currentRetryCount<5){var newConnectionMode=switchConnectionMode(instance,connectionMode);setTimeout(function(){tryReconnectInternal(instance,resolve,reject,newConnectionMode,currentRetryCount+1)},300)}else reject()})}function tryReconnect(instance){return new Promise(function(resolve,reject){setTimeout(function(){tryReconnectInternal(instance,resolve,reject,instance.serverInfo().LastConnectionMode,0)},300)})}function onWebSocketMessage(instance,msg){if("UserDeleted"===msg.MessageType)instance._currentUser=null;else if("UserUpdated"===msg.MessageType||"UserConfigurationUpdated"===msg.MessageType){var user=msg.Data;user.Id===instance.getCurrentUserId()&&(instance._currentUser=null)}events.trigger(instance,"websocketmessage",[msg])}function normalizeReturnBitrate(instance,bitrate){if(!bitrate)return instance.lastDetectedBitrate?instance.lastDetectedBitrate:Promise.reject();var result=Math.round(.8*bitrate);return instance.lastDetectedBitrate=result,instance.lastDetectedBitrateTime=(new Date).getTime(),result}function detectBitrateInternal(instance,tests,index,currentBitrate){if(index>=tests.length)return normalizeReturnBitrate(instance,currentBitrate);var test=tests[index];return instance.getDownloadSpeed(test.bytes).then(function(bitrate){return bitrate1800?this.ajax({type:"POST",url:this.getUrl("LiveTv/Programs"),data:JSON.stringify(options),contentType:"application/json",dataType:"json"}):this.ajax({type:"GET",url:this.getUrl("LiveTv/Programs",options),dataType:"json"})},ApiClient.prototype.getLiveTvRecommendedPrograms=function(options){return options=options||{},this.ajax({type:"GET",url:this.getUrl("LiveTv/Programs/Recommended",options),dataType:"json"})},ApiClient.prototype.getLiveTvRecordings=function(options){var url=this.getUrl("LiveTv/Recordings",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvRecordingSeries=function(options){var url=this.getUrl("LiveTv/Recordings/Series",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvRecordingGroups=function(options){var url=this.getUrl("LiveTv/Recordings/Groups",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvRecordingGroup=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Recordings/Groups/"+id);return this.getJSON(url)},ApiClient.prototype.getLiveTvRecording=function(id,userId){if(!id)throw new Error("null id");var options={};userId&&(options.userId=userId);var url=this.getUrl("LiveTv/Recordings/"+id,options);return this.getJSON(url)},ApiClient.prototype.getLiveTvProgram=function(id,userId){if(!id)throw new Error("null id");var options={};userId&&(options.userId=userId);var url=this.getUrl("LiveTv/Programs/"+id,options);return this.getJSON(url)},ApiClient.prototype.deleteLiveTvRecording=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Recordings/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.cancelLiveTvTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Timers/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.getLiveTvTimers=function(options){var url=this.getUrl("LiveTv/Timers",options||{});return this.getJSON(url)},ApiClient.prototype.getLiveTvTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Timers/"+id);return this.getJSON(url)},ApiClient.prototype.getNewLiveTvTimerDefaults=function(options){options=options||{};var url=this.getUrl("LiveTv/Timers/Defaults",options);return this.getJSON(url)},ApiClient.prototype.createLiveTvTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/Timers");return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.updateLiveTvTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/Timers/"+item.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.resetLiveTvTuner=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/Tuners/"+id+"/Reset");return this.ajax({type:"POST",url:url})},ApiClient.prototype.getLiveTvSeriesTimers=function(options){var url=this.getUrl("LiveTv/SeriesTimers",options||{});return this.getJSON(url)},ApiClient.prototype.getFileOrganizationResults=function(options){var url=this.getUrl("Library/FileOrganization",options||{});return this.getJSON(url)},ApiClient.prototype.deleteOriginalFileFromOrganizationResult=function(id){var url=this.getUrl("Library/FileOrganizations/"+id+"/File");return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.clearOrganizationLog=function(){var url=this.getUrl("Library/FileOrganizations");return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.performOrganization=function(id){var url=this.getUrl("Library/FileOrganizations/"+id+"/Organize");return this.ajax({type:"POST",url:url})},ApiClient.prototype.performEpisodeOrganization=function(id,options){var url=this.getUrl("Library/FileOrganizations/"+id+"/Episode/Organize");return this.ajax({type:"POST",url:url,data:JSON.stringify(options),contentType:"application/json"})},ApiClient.prototype.getLiveTvSeriesTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/SeriesTimers/"+id);return this.getJSON(url)},ApiClient.prototype.cancelLiveTvSeriesTimer=function(id){if(!id)throw new Error("null id");var url=this.getUrl("LiveTv/SeriesTimers/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.createLiveTvSeriesTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/SeriesTimers");return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.updateLiveTvSeriesTimer=function(item){if(!item)throw new Error("null item");var url=this.getUrl("LiveTv/SeriesTimers/"+item.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.getRegistrationInfo=function(feature){var url=this.getUrl("Registrations/"+feature);return this.getJSON(url)},ApiClient.prototype.getSystemInfo=function(){var url=this.getUrl("System/Info");return this.getJSON(url)},ApiClient.prototype.getPublicSystemInfo=function(){var url=this.getUrl("System/Info/Public");return this.getJSON(url,!1)},ApiClient.prototype.getInstantMixFromItem=function(itemId,options){var url=this.getUrl("Items/"+itemId+"/InstantMix",options);return this.getJSON(url)},ApiClient.prototype.getEpisodes=function(itemId,options){var url=this.getUrl("Shows/"+itemId+"/Episodes",options);return this.getJSON(url)},ApiClient.prototype.getDisplayPreferences=function(id,userId,app){var url=this.getUrl("DisplayPreferences/"+id,{userId:userId,client:app});return this.getJSON(url)},ApiClient.prototype.updateDisplayPreferences=function(id,obj,userId,app){var url=this.getUrl("DisplayPreferences/"+id,{userId:userId,client:app});return this.ajax({type:"POST",url:url,data:JSON.stringify(obj),contentType:"application/json"})},ApiClient.prototype.getSeasons=function(itemId,options){var url=this.getUrl("Shows/"+itemId+"/Seasons",options);return this.getJSON(url)},ApiClient.prototype.getSimilarItems=function(itemId,options){var url=this.getUrl("Items/"+itemId+"/Similar",options);return this.getJSON(url)},ApiClient.prototype.getCultures=function(){var url=this.getUrl("Localization/cultures");return this.getJSON(url)},ApiClient.prototype.getCountries=function(){var url=this.getUrl("Localization/countries");return this.getJSON(url)},ApiClient.prototype.getPluginSecurityInfo=function(){var url=this.getUrl("Plugins/SecurityInfo");return this.getJSON(url)},ApiClient.prototype.getPlaybackInfo=function(itemId,options,deviceProfile){var postData={DeviceProfile:deviceProfile};return this.ajax({url:this.getUrl("Items/"+itemId+"/PlaybackInfo",options),type:"POST",data:JSON.stringify(postData),contentType:"application/json",dataType:"json"})},ApiClient.prototype.getIntros=function(itemId){return this.getJSON(this.getUrl("Users/"+this.getCurrentUserId()+"/Items/"+itemId+"/Intros"))},ApiClient.prototype.getDirectoryContents=function(path,options){if(!path)throw new Error("null path");if("string"!=typeof path)throw new Error("invalid path");options=options||{},options.path=path;var url=this.getUrl("Environment/DirectoryContents",options);return this.getJSON(url)},ApiClient.prototype.getNetworkShares=function(path){if(!path)throw new Error("null path");var options={};options.path=path;var url=this.getUrl("Environment/NetworkShares",options);return this.getJSON(url)},ApiClient.prototype.getParentPath=function(path){if(!path)throw new Error("null path");var options={};options.path=path;var url=this.getUrl("Environment/ParentPath",options);return this.ajax({type:"GET",url:url,dataType:"text"})},ApiClient.prototype.getDrives=function(){var url=this.getUrl("Environment/Drives");return this.getJSON(url)},ApiClient.prototype.getNetworkDevices=function(){var url=this.getUrl("Environment/NetworkDevices");return this.getJSON(url)},ApiClient.prototype.cancelPackageInstallation=function(installationId){if(!installationId)throw new Error("null installationId");var url=this.getUrl("Packages/Installing/"+installationId);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.refreshItem=function(itemId,options){if(!itemId)throw new Error("null itemId");var url=this.getUrl("Items/"+itemId+"/Refresh",options||{});return this.ajax({type:"POST",url:url})},ApiClient.prototype.installPlugin=function(name,guid,updateClass,version){if(!name)throw new Error("null name");if(!updateClass)throw new Error("null updateClass");var options={updateClass:updateClass,AssemblyGuid:guid};version&&(options.version=version);var url=this.getUrl("Packages/Installed/"+name,options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.restartServer=function(){var url=this.getUrl("System/Restart");return this.ajax({type:"POST",url:url})},ApiClient.prototype.shutdownServer=function(){var url=this.getUrl("System/Shutdown");return this.ajax({type:"POST",url:url})},ApiClient.prototype.getPackageInfo=function(name,guid){if(!name)throw new Error("null name");var options={AssemblyGuid:guid},url=this.getUrl("Packages/"+name,options);return this.getJSON(url)},ApiClient.prototype.getAvailableApplicationUpdate=function(){var url=this.getUrl("Packages/Updates",{PackageType:"System"});return this.getJSON(url)},ApiClient.prototype.getAvailablePluginUpdates=function(){var url=this.getUrl("Packages/Updates",{PackageType:"UserInstalled"});return this.getJSON(url)},ApiClient.prototype.getVirtualFolders=function(){var url="Library/VirtualFolders";return url=this.getUrl(url),this.getJSON(url)},ApiClient.prototype.getPhysicalPaths=function(){var url=this.getUrl("Library/PhysicalPaths");return this.getJSON(url)},ApiClient.prototype.getServerConfiguration=function(){var url=this.getUrl("System/Configuration");return this.getJSON(url)},ApiClient.prototype.getDevicesOptions=function(){var url=this.getUrl("System/Configuration/devices");return this.getJSON(url)},ApiClient.prototype.getContentUploadHistory=function(){var url=this.getUrl("Devices/CameraUploads",{DeviceId:this.deviceId()});return this.getJSON(url)},ApiClient.prototype.getNamedConfiguration=function(name){var url=this.getUrl("System/Configuration/"+name);return this.getJSON(url)},ApiClient.prototype.getScheduledTasks=function(options){options=options||{};var url=this.getUrl("ScheduledTasks",options);return this.getJSON(url)},ApiClient.prototype.startScheduledTask=function(id){if(!id)throw new Error("null id");var url=this.getUrl("ScheduledTasks/Running/"+id);return this.ajax({type:"POST",url:url})},ApiClient.prototype.getScheduledTask=function(id){if(!id)throw new Error("null id");var url=this.getUrl("ScheduledTasks/"+id);return this.getJSON(url)},ApiClient.prototype.getNextUpEpisodes=function(options){var url=this.getUrl("Shows/NextUp",options);return this.getJSON(url)},ApiClient.prototype.stopScheduledTask=function(id){if(!id)throw new Error("null id");var url=this.getUrl("ScheduledTasks/Running/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.getPluginConfiguration=function(id){if(!id)throw new Error("null Id");var url=this.getUrl("Plugins/"+id+"/Configuration");return this.getJSON(url)},ApiClient.prototype.getAvailablePlugins=function(options){options=options||{},options.PackageType="UserInstalled";var url=this.getUrl("Packages",options);return this.getJSON(url)},ApiClient.prototype.uninstallPlugin=function(id){if(!id)throw new Error("null Id");var url=this.getUrl("Plugins/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.removeVirtualFolder=function(name,refreshLibrary){if(!name)throw new Error("null name");var url="Library/VirtualFolders";return url=this.getUrl(url,{refreshLibrary:!!refreshLibrary,name:name}),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.addVirtualFolder=function(name,type,refreshLibrary,libraryOptions){if(!name)throw new Error("null name");var options={};type&&(options.collectionType=type),options.refreshLibrary=!!refreshLibrary,options.name=name;var url="Library/VirtualFolders";return url=this.getUrl(url,options),this.ajax({type:"POST",url:url,data:JSON.stringify({LibraryOptions:libraryOptions}),contentType:"application/json"})},ApiClient.prototype.updateVirtualFolderOptions=function(id,libraryOptions){if(!id)throw new Error("null name");var url="Library/VirtualFolders/LibraryOptions";return url=this.getUrl(url),this.ajax({type:"POST",url:url,data:JSON.stringify({Id:id,LibraryOptions:libraryOptions}),contentType:"application/json"})},ApiClient.prototype.renameVirtualFolder=function(name,newName,refreshLibrary){if(!name)throw new Error("null name");var url="Library/VirtualFolders/Name";return url=this.getUrl(url,{refreshLibrary:!!refreshLibrary,newName:newName,name:name}),this.ajax({type:"POST",url:url})},ApiClient.prototype.addMediaPath=function(virtualFolderName,mediaPath,networkSharePath,refreshLibrary){if(!virtualFolderName)throw new Error("null virtualFolderName");if(!mediaPath)throw new Error("null mediaPath");var url="Library/VirtualFolders/Paths",pathInfo={Path:mediaPath};return networkSharePath&&(pathInfo.NetworkPath=networkSharePath),url=this.getUrl(url,{refreshLibrary:!!refreshLibrary}),this.ajax({type:"POST",url:url,data:JSON.stringify({Name:virtualFolderName,PathInfo:pathInfo}),contentType:"application/json"})},ApiClient.prototype.updateMediaPath=function(virtualFolderName,pathInfo){ +if(!virtualFolderName)throw new Error("null virtualFolderName");if(!pathInfo)throw new Error("null pathInfo");var url="Library/VirtualFolders/Paths/Update";return url=this.getUrl(url),this.ajax({type:"POST",url:url,data:JSON.stringify({Name:virtualFolderName,PathInfo:pathInfo}),contentType:"application/json"})},ApiClient.prototype.removeMediaPath=function(virtualFolderName,mediaPath,refreshLibrary){if(!virtualFolderName)throw new Error("null virtualFolderName");if(!mediaPath)throw new Error("null mediaPath");var url="Library/VirtualFolders/Paths";return url=this.getUrl(url,{refreshLibrary:!!refreshLibrary,path:mediaPath,name:virtualFolderName}),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteUser=function(id){if(!id)throw new Error("null id");var url=this.getUrl("Users/"+id);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteUserImage=function(userId,imageType,imageIndex){if(!userId)throw new Error("null userId");if(!imageType)throw new Error("null imageType");var url=this.getUrl("Users/"+userId+"/Images/"+imageType);return null!=imageIndex&&(url+="/"+imageIndex),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteItemImage=function(itemId,imageType,imageIndex){if(!imageType)throw new Error("null imageType");var url=this.getUrl("Items/"+itemId+"/Images");return url+="/"+imageType,null!=imageIndex&&(url+="/"+imageIndex),this.ajax({type:"DELETE",url:url})},ApiClient.prototype.deleteItem=function(itemId){if(!itemId)throw new Error("null itemId");var url=this.getUrl("Items/"+itemId);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.stopActiveEncodings=function(playSessionId){var options={deviceId:this.deviceId()};playSessionId&&(options.PlaySessionId=playSessionId);var url=this.getUrl("Videos/ActiveEncodings",options);return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.reportCapabilities=function(options){var url=this.getUrl("Sessions/Capabilities/Full");return this.ajax({type:"POST",url:url,data:JSON.stringify(options),contentType:"application/json"})},ApiClient.prototype.updateItemImageIndex=function(itemId,imageType,imageIndex,newIndex){if(!imageType)throw new Error("null imageType");var options={newIndex:newIndex},url=this.getUrl("Items/"+itemId+"/Images/"+imageType+"/"+imageIndex+"/Index",options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.getItemImageInfos=function(itemId){var url=this.getUrl("Items/"+itemId+"/Images");return this.getJSON(url)},ApiClient.prototype.getCriticReviews=function(itemId,options){if(!itemId)throw new Error("null itemId");var url=this.getUrl("Items/"+itemId+"/CriticReviews",options);return this.getJSON(url)},ApiClient.prototype.getItemDownloadUrl=function(itemId){if(!itemId)throw new Error("itemId cannot be empty");var url="Items/"+itemId+"/Download";return this.getUrl(url,{api_key:this.accessToken()})},ApiClient.prototype.getSessions=function(options){var url=this.getUrl("Sessions",options);return this.getJSON(url)},ApiClient.prototype.uploadUserImage=function(userId,imageType,file){if(!userId)throw new Error("null userId");if(!imageType)throw new Error("null imageType");if(!file)throw new Error("File must be an image.");if("image/png"!==file.type&&"image/jpeg"!==file.type&&"image/jpeg"!==file.type)throw new Error("File must be an image.");var instance=this;return new Promise(function(resolve,reject){var reader=new FileReader;reader.onerror=function(){reject()},reader.onabort=function(){reject()},reader.onload=function(e){var data=e.target.result.split(",")[1],url=instance.getUrl("Users/"+userId+"/Images/"+imageType);instance.ajax({type:"POST",url:url,data:data,contentType:"image/"+file.name.substring(file.name.lastIndexOf(".")+1)}).then(resolve,reject)},reader.readAsDataURL(file)})},ApiClient.prototype.uploadItemImage=function(itemId,imageType,file){if(!itemId)throw new Error("null itemId");if(!imageType)throw new Error("null imageType");if(!file)throw new Error("File must be an image.");if("image/png"!==file.type&&"image/jpeg"!==file.type&&"image/jpeg"!==file.type)throw new Error("File must be an image.");var url=this.getUrl("Items/"+itemId+"/Images");url+="/"+imageType;var instance=this;return new Promise(function(resolve,reject){var reader=new FileReader;reader.onerror=function(){reject()},reader.onabort=function(){reject()},reader.onload=function(e){var data=e.target.result.split(",")[1];instance.ajax({type:"POST",url:url,data:data,contentType:"image/"+file.name.substring(file.name.lastIndexOf(".")+1)}).then(resolve,reject)},reader.readAsDataURL(file)})},ApiClient.prototype.getInstalledPlugins=function(){var options={},url=this.getUrl("Plugins",options);return this.getJSON(url)},ApiClient.prototype.getUser=function(id){if(!id)throw new Error("Must supply a userId");var url=this.getUrl("Users/"+id);return this.getJSON(url)},ApiClient.prototype.getStudio=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Studios/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getGenre=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Genres/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getMusicGenre=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("MusicGenres/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getGameGenre=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("GameGenres/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getArtist=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Artists/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getPerson=function(name,userId){if(!name)throw new Error("null name");var options={};userId&&(options.userId=userId);var url=this.getUrl("Persons/"+this.encodeName(name),options);return this.getJSON(url)},ApiClient.prototype.getPublicUsers=function(){var url=this.getUrl("users/public");return this.ajax({type:"GET",url:url,dataType:"json"},!1)},ApiClient.prototype.getUsers=function(options){var url=this.getUrl("users",options||{});return this.getJSON(url)},ApiClient.prototype.getParentalRatings=function(){var url=this.getUrl("Localization/ParentalRatings");return this.getJSON(url)},ApiClient.prototype.getDefaultImageQuality=function(imageType){return"backdrop"===imageType.toLowerCase()?80:90},ApiClient.prototype.getUserImageUrl=function(userId,options){if(!userId)throw new Error("null userId");options=options||{};var url="Users/"+userId+"/Images/"+options.type;return null!=options.index&&(url+="/"+options.index),normalizeImageOptions(this,options),delete options.type,delete options.index,this.getUrl(url,options)},ApiClient.prototype.getImageUrl=function(itemId,options){if(!itemId)throw new Error("itemId cannot be empty");options=options||{};var url="Items/"+itemId+"/Images/"+options.type;return null!=options.index&&(url+="/"+options.index),options.quality=options.quality||this.getDefaultImageQuality(options.type),this.normalizeImageOptions&&this.normalizeImageOptions(options),delete options.type,delete options.index,this.getUrl(url,options)},ApiClient.prototype.getScaledImageUrl=function(itemId,options){if(!itemId)throw new Error("itemId cannot be empty");options=options||{};var url="Items/"+itemId+"/Images/"+options.type;return null!=options.index&&(url+="/"+options.index),normalizeImageOptions(this,options),delete options.type,delete options.index,delete options.minScale,this.getUrl(url,options)},ApiClient.prototype.getThumbImageUrl=function(item,options){if(!item)throw new Error("null item");return options=options||{},options.imageType="thumb",item.ImageTags&&item.ImageTags.Thumb?(options.tag=item.ImageTags.Thumb,this.getImageUrl(item.Id,options)):item.ParentThumbItemId?(options.tag=item.ImageTags.ParentThumbImageTag,this.getImageUrl(item.ParentThumbItemId,options)):null},ApiClient.prototype.updateUserPassword=function(userId,currentPassword,newPassword){if(!userId)return Promise.reject();var url=this.getUrl("Users/"+userId+"/Password"),instance=this;return new Promise(function(resolve,reject){require(["cryptojs-sha1"],function(){instance.ajax({type:"POST",url:url,data:{currentPassword:CryptoJS.SHA1(currentPassword).toString(),newPassword:CryptoJS.SHA1(newPassword).toString()}}).then(resolve,reject)})})},ApiClient.prototype.updateEasyPassword=function(userId,newPassword){var instance=this;return new Promise(function(resolve,reject){if(!userId)return void reject();var url=this.getUrl("Users/"+userId+"/EasyPassword");require(["cryptojs-sha1"],function(){instance.ajax({type:"POST",url:url,data:{newPassword:CryptoJS.SHA1(newPassword).toString()}}).then(resolve,reject)})})},ApiClient.prototype.resetUserPassword=function(userId){if(!userId)throw new Error("null userId");var url=this.getUrl("Users/"+userId+"/Password"),postData={};return postData.resetPassword=!0,this.ajax({type:"POST",url:url,data:postData})},ApiClient.prototype.resetEasyPassword=function(userId){if(!userId)throw new Error("null userId");var url=this.getUrl("Users/"+userId+"/EasyPassword"),postData={};return postData.resetPassword=!0,this.ajax({type:"POST",url:url,data:postData})},ApiClient.prototype.updateServerConfiguration=function(configuration){if(!configuration)throw new Error("null configuration");var url=this.getUrl("System/Configuration");return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.updateNamedConfiguration=function(name,configuration){if(!configuration)throw new Error("null configuration");var url=this.getUrl("System/Configuration/"+name);return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.updateItem=function(item){if(!item)throw new Error("null item");var url=this.getUrl("Items/"+item.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(item),contentType:"application/json"})},ApiClient.prototype.updatePluginSecurityInfo=function(info){var url=this.getUrl("Plugins/SecurityInfo");return this.ajax({type:"POST",url:url,data:JSON.stringify(info),contentType:"application/json"})},ApiClient.prototype.createUser=function(name){var url=this.getUrl("Users/New");return this.ajax({type:"POST",url:url,data:{Name:name},dataType:"json"})},ApiClient.prototype.updateUser=function(user){if(!user)throw new Error("null user");var url=this.getUrl("Users/"+user.Id);return this.ajax({type:"POST",url:url,data:JSON.stringify(user),contentType:"application/json"})},ApiClient.prototype.updateUserPolicy=function(userId,policy){if(!userId)throw new Error("null userId");if(!policy)throw new Error("null policy");var url=this.getUrl("Users/"+userId+"/Policy");return this.ajax({type:"POST",url:url,data:JSON.stringify(policy),contentType:"application/json"})},ApiClient.prototype.updateUserConfiguration=function(userId,configuration){if(!userId)throw new Error("null userId");if(!configuration)throw new Error("null configuration");var url=this.getUrl("Users/"+userId+"/Configuration");return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.updateScheduledTaskTriggers=function(id,triggers){if(!id)throw new Error("null id");if(!triggers)throw new Error("null triggers");var url=this.getUrl("ScheduledTasks/"+id+"/Triggers");return this.ajax({type:"POST",url:url,data:JSON.stringify(triggers),contentType:"application/json"})},ApiClient.prototype.updatePluginConfiguration=function(id,configuration){if(!id)throw new Error("null Id");if(!configuration)throw new Error("null configuration");var url=this.getUrl("Plugins/"+id+"/Configuration");return this.ajax({type:"POST",url:url,data:JSON.stringify(configuration),contentType:"application/json"})},ApiClient.prototype.getAncestorItems=function(itemId,userId){if(!itemId)throw new Error("null itemId");var options={};userId&&(options.userId=userId);var url=this.getUrl("Items/"+itemId+"/Ancestors",options);return this.getJSON(url)},ApiClient.prototype.getItems=function(userId,options){var url;return url="string"===(typeof userId).toString().toLowerCase()?this.getUrl("Users/"+userId+"/Items",options):this.getUrl("Items",options),this.getJSON(url)},ApiClient.prototype.getMovieRecommendations=function(options){return this.getJSON(this.getUrl("Movies/Recommendations",options))},ApiClient.prototype.getUpcomingEpisodes=function(options){return this.getJSON(this.getUrl("Shows/Upcoming",options))},ApiClient.prototype.getChannels=function(query){return this.getJSON(this.getUrl("Channels",query||{}))},ApiClient.prototype.getLatestChannelItems=function(query){return this.getJSON(this.getUrl("Channels/Items/Latest",query))},ApiClient.prototype.getUserViews=function(options,userId){options=options||{};var url=this.getUrl("Users/"+(userId||this.getCurrentUserId())+"/Views",options);return this.getJSON(url)},ApiClient.prototype.getArtists=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Artists",options);return this.getJSON(url)},ApiClient.prototype.getAlbumArtists=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Artists/AlbumArtists",options);return this.getJSON(url)},ApiClient.prototype.getGenres=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Genres",options);return this.getJSON(url)},ApiClient.prototype.getMusicGenres=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("MusicGenres",options);return this.getJSON(url)},ApiClient.prototype.getGameGenres=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("GameGenres",options);return this.getJSON(url)},ApiClient.prototype.getPeople=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Persons",options);return this.getJSON(url)},ApiClient.prototype.getStudios=function(userId,options){if(!userId)throw new Error("null userId");options=options||{},options.userId=userId;var url=this.getUrl("Studios",options);return this.getJSON(url)},ApiClient.prototype.getLocalTrailers=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/LocalTrailers");return this.getJSON(url)},ApiClient.prototype.getGameSystems=function(){var options={},userId=this.getCurrentUserId();userId&&(options.userId=userId);var url=this.getUrl("Games/SystemSummaries",options);return this.getJSON(url)},ApiClient.prototype.getAdditionalVideoParts=function(userId,itemId){if(!itemId)throw new Error("null itemId");var options={};userId&&(options.userId=userId);var url=this.getUrl("Videos/"+itemId+"/AdditionalParts",options);return this.getJSON(url)},ApiClient.prototype.getThemeMedia=function(userId,itemId,inherit){if(!itemId)throw new Error("null itemId");var options={};userId&&(options.userId=userId),options.InheritFromParent=inherit||!1;var url=this.getUrl("Items/"+itemId+"/ThemeMedia",options);return this.getJSON(url)},ApiClient.prototype.getSearchHints=function(options){var url=this.getUrl("Search/Hints",options),serverId=this.serverId();return this.getJSON(url).then(function(result){return result.SearchHints.forEach(function(i){i.ServerId=serverId}),result})},ApiClient.prototype.getSpecialFeatures=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/SpecialFeatures");return this.getJSON(url)},ApiClient.prototype.getDateParamValue=function(date){function formatDigit(i){return i<10?"0"+i:i}var d=date;return""+d.getFullYear()+formatDigit(d.getMonth()+1)+formatDigit(d.getDate())+formatDigit(d.getHours())+formatDigit(d.getMinutes())+formatDigit(d.getSeconds())},ApiClient.prototype.markPlayed=function(userId,itemId,date){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var options={};date&&(options.DatePlayed=this.getDateParamValue(date));var url=this.getUrl("Users/"+userId+"/PlayedItems/"+itemId,options);return this.ajax({type:"POST",url:url,dataType:"json"})},ApiClient.prototype.markUnplayed=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/PlayedItems/"+itemId);return this.ajax({type:"DELETE",url:url,dataType:"json"})},ApiClient.prototype.updateFavoriteStatus=function(userId,itemId,isFavorite){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/FavoriteItems/"+itemId),method=isFavorite?"POST":"DELETE";return this.ajax({type:method,url:url,dataType:"json"})},ApiClient.prototype.updateUserItemRating=function(userId,itemId,likes){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/Rating",{likes:likes});return this.ajax({type:"POST",url:url,dataType:"json"})},ApiClient.prototype.getItemCounts=function(userId){var options={};userId&&(options.userId=userId);var url=this.getUrl("Items/Counts",options);return this.getJSON(url)},ApiClient.prototype.clearUserItemRating=function(userId,itemId){if(!userId)throw new Error("null userId");if(!itemId)throw new Error("null itemId");var url=this.getUrl("Users/"+userId+"/Items/"+itemId+"/Rating");return this.ajax({type:"DELETE",url:url,dataType:"json"})},ApiClient.prototype.reportPlaybackStart=function(options){if(!options)throw new Error("null options");this.lastPlaybackProgressReport=0,stopBitrateDetection(this);var url=this.getUrl("Sessions/Playing");return this.ajax({type:"POST",data:JSON.stringify(options),contentType:"application/json",url:url})},ApiClient.prototype.reportPlaybackProgress=function(options){if(!options)throw new Error("null options");if("timeupdate"===(options.EventName||"timeupdate")){var now=(new Date).getTime();if(now-(this.lastPlaybackProgressReport||0)<=1e4)return;this.lastPlaybackProgressReport=now}else this.lastPlaybackProgressReport=0;var url=this.getUrl("Sessions/Playing/Progress");return this.ajax({type:"POST",data:JSON.stringify(options),contentType:"application/json",url:url})},ApiClient.prototype.reportOfflineActions=function(actions){if(!actions)throw new Error("null actions");var url=this.getUrl("Sync/OfflineActions");return this.ajax({type:"POST",data:JSON.stringify(actions),contentType:"application/json",url:url})},ApiClient.prototype.syncData=function(data){if(!data)throw new Error("null data");var url=this.getUrl("Sync/Data");return this.ajax({type:"POST",data:JSON.stringify(data),contentType:"application/json",url:url,dataType:"json"})},ApiClient.prototype.getReadySyncItems=function(deviceId){if(!deviceId)throw new Error("null deviceId");var url=this.getUrl("Sync/Items/Ready",{TargetId:deviceId});return this.getJSON(url)},ApiClient.prototype.reportSyncJobItemTransferred=function(syncJobItemId){if(!syncJobItemId)throw new Error("null syncJobItemId");var url=this.getUrl("Sync/JobItems/"+syncJobItemId+"/Transferred");return this.ajax({type:"POST",url:url})},ApiClient.prototype.cancelSyncItems=function(itemIds,targetId){if(!itemIds)throw new Error("null itemIds");var url=this.getUrl("Sync/"+(targetId||this.deviceId())+"/Items",{ItemIds:itemIds.join(",")});return this.ajax({type:"DELETE",url:url})},ApiClient.prototype.reportPlaybackStopped=function(options){if(!options)throw new Error("null options");this.lastPlaybackProgressReport=0,redetectBitrate(this);var url=this.getUrl("Sessions/Playing/Stopped");return this.ajax({type:"POST",data:JSON.stringify(options),contentType:"application/json",url:url})},ApiClient.prototype.sendPlayCommand=function(sessionId,options){if(!sessionId)throw new Error("null sessionId");if(!options)throw new Error("null options");var url=this.getUrl("Sessions/"+sessionId+"/Playing",options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.sendCommand=function(sessionId,command){if(!sessionId)throw new Error("null sessionId");if(!command)throw new Error("null command");var url=this.getUrl("Sessions/"+sessionId+"/Command"),ajaxOptions={type:"POST",url:url};return ajaxOptions.data=JSON.stringify(command),ajaxOptions.contentType="application/json",this.ajax(ajaxOptions)},ApiClient.prototype.sendMessageCommand=function(sessionId,options){if(!sessionId)throw new Error("null sessionId");if(!options)throw new Error("null options");var url=this.getUrl("Sessions/"+sessionId+"/Message",options);return this.ajax({type:"POST",url:url})},ApiClient.prototype.sendPlayStateCommand=function(sessionId,command,options){if(!sessionId)throw new Error("null sessionId");if(!command)throw new Error("null command");var url=this.getUrl("Sessions/"+sessionId+"/Playing/"+command,options||{});return this.ajax({type:"POST",url:url})},ApiClient.prototype.createPackageReview=function(review){var url=this.getUrl("Packages/Reviews/"+review.id,review);return this.ajax({type:"POST",url:url})},ApiClient.prototype.getPackageReviews=function(packageId,minRating,maxRating,limit){if(!packageId)throw new Error("null packageId");var options={};minRating&&(options.MinRating=minRating),maxRating&&(options.MaxRating=maxRating),limit&&(options.Limit=limit);var url=this.getUrl("Packages/"+packageId+"/Reviews",options);return this.getJSON(url)},ApiClient.prototype.getSmartMatchInfos=function(options){options=options||{};var url=this.getUrl("Library/FileOrganizations/SmartMatches",options);return this.ajax({type:"GET",url:url,dataType:"json"})},ApiClient.prototype.deleteSmartMatchEntries=function(entries){var url=this.getUrl("Library/FileOrganizations/SmartMatches/Delete"),postData={Entries:entries};return this.ajax({type:"POST",url:url,data:JSON.stringify(postData),contentType:"application/json"})},ApiClient.prototype.getEndpointInfo=function(){return this.getJSON(this.getUrl("System/Endpoint"))},ApiClient.prototype.getLatestItems=function(options){return options=options||{},this.getJSON(this.getUrl("Users/"+this.getCurrentUserId()+"/Items/Latest",options))},ApiClient}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-apiclient/sync/contentuploader.js b/dashboard-ui/bower_components/emby-apiclient/sync/contentuploader.js index 5a50fe6bb0..4b6c8a94e8 100644 --- a/dashboard-ui/bower_components/emby-apiclient/sync/contentuploader.js +++ b/dashboard-ui/bower_components/emby-apiclient/sync/contentuploader.js @@ -1 +1 @@ -define(["localassetmanager","cameraRoll"],function(localAssetManager,cameraRoll){"use strict";return function(connectionManager){function getFilesToUpload(files,uploadHistory){return files.filter(function(file){return!!file&&0===uploadHistory.FilesUploaded.filter(function(u){return getUploadId(file)===u.Id}).length})}function getUploadId(file){return CryptoJS.SHA1(file+"1").toString()}function uploadNext(files,index,server,apiClient,resolve,reject){var length=files.length;return index>=length?void resolve():void uploadFile(files[index],apiClient).then(function(){uploadNext(files,index+1,server,apiClient,resolve,reject)},function(){uploadNext(files,index+1,server,apiClient,resolve,reject)})}function uploadFile(file,apiClient){return new Promise(function(resolve,reject){require(["fileupload","cryptojs-sha1"],function(FileUpload){var name="camera image "+(new Date).getTime(),url=apiClient.getUrl("Devices/CameraUploads",{DeviceId:apiClient.deviceId(),Name:name,Album:"Camera Roll",Id:getUploadId(file),api_key:apiClient.accessToken()});console.log("Uploading file to "+url),(new FileUpload).upload(file,name,url).then(resolve,reject)})})}var self=this;self.uploadImages=function(server){return cameraRoll.getFiles().then(function(photos){if(!photos.length)return Promise.resolve();var apiClient=connectionManager.getApiClient(server.Id);return apiClient.getContentUploadHistory().then(function(uploadHistory){return photos=getFilesToUpload(photos,uploadHistory),console.log("Found "+photos.length+" files to upload"),new Promise(function(resolve,reject){uploadNext(photos,0,server,apiClient,resolve,reject)})},function(){return Promise.resolve()})})}}}); \ No newline at end of file +define(["localassetmanager","cameraRoll"],function(localAssetManager,cameraRoll){"use strict";function getFilesToUpload(files,uploadHistory){return files.filter(function(file){return!!file&&0===uploadHistory.FilesUploaded.filter(function(u){return getUploadId(file)===u.Id}).length})}function getUploadId(file){return CryptoJS.SHA1(file+"1").toString()}function uploadNext(files,index,server,apiClient,resolve,reject){var length=files.length;return index>=length?void resolve():void uploadFile(files[index],apiClient).then(function(){uploadNext(files,index+1,server,apiClient,resolve,reject)},function(){uploadNext(files,index+1,server,apiClient,resolve,reject)})}function uploadFile(file,apiClient){return new Promise(function(resolve,reject){require(["fileupload","cryptojs-sha1"],function(FileUpload){var name="camera image "+(new Date).getTime(),url=apiClient.getUrl("Devices/CameraUploads",{DeviceId:apiClient.deviceId(),Name:name,Album:"Camera Roll",Id:getUploadId(file),api_key:apiClient.accessToken()});console.log("Uploading file to "+url),(new FileUpload).upload(file,name,url).then(resolve,reject)})})}function ContentUploader(){}return ContentUploader.prototype.uploadImages=function(connectionManager,server){return cameraRoll.getFiles().then(function(photos){if(!photos.length)return Promise.resolve();var apiClient=connectionManager.getApiClient(server.Id);return apiClient.getContentUploadHistory().then(function(uploadHistory){return photos=getFilesToUpload(photos,uploadHistory),console.log("Found "+photos.length+" files to upload"),new Promise(function(resolve,reject){uploadNext(photos,0,server,apiClient,resolve,reject)})},function(){return Promise.resolve()})})},ContentUploader}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-apiclient/sync/serversync.js b/dashboard-ui/bower_components/emby-apiclient/sync/serversync.js index 2f7748fbc9..2dc8d71949 100644 --- a/dashboard-ui/bower_components/emby-apiclient/sync/serversync.js +++ b/dashboard-ui/bower_components/emby-apiclient/sync/serversync.js @@ -1 +1 @@ -define([],function(){"use strict";function performSync(connectionManager,server,options){console.log("ServerSync.performSync to server: "+server.Id),options=options||{};var uploadPhotos=options.uploadPhotos!==!1;options.cameraUploadServers&&options.cameraUploadServers.indexOf(server.Id)===-1&&(uploadPhotos=!1);var pr=Promise.resolve();return pr.then(function(){return uploadPhotos?uploadContent(connectionManager,server,options):Promise.resolve()}).then(function(){return syncMedia(connectionManager,server,options)})}function uploadContent(connectionManager,server,options){return new Promise(function(resolve,reject){require(["contentuploader"],function(ContentUploader){var uploader=new ContentUploader(connectionManager);uploader.uploadImages(server).then(resolve,reject)})})}function syncMedia(connectionManager,server,options){return new Promise(function(resolve,reject){require(["mediasync"],function(MediaSync){var apiClient=connectionManager.getApiClient(server.Id);(new MediaSync).sync(apiClient,server,options).then(resolve,reject)})})}function ServerSync(){}return ServerSync.prototype.sync=function(connectionManager,server,options){if(!server.AccessToken&&!server.ExchangeToken)return console.log("Skipping sync to server "+server.Id+" because there is no saved authentication information."),Promise.resolve();var connectionOptions={updateDateLastAccessed:!1,enableWebSocket:!1,reportCapabilities:!1,enableAutomaticBitrateDetection:!1};return connectionManager.connectToServer(server,connectionOptions).then(function(result){return result.State===MediaBrowser.ConnectionState.SignedIn?performSync(server,options):(console.log("Unable to connect to server id: "+server.Id),Promise.reject())},function(err){throw console.log("Unable to connect to server id: "+server.Id),err})},ServerSync}); \ No newline at end of file +define([],function(){"use strict";function performSync(connectionManager,server,options){console.log("ServerSync.performSync to server: "+server.Id),options=options||{};var uploadPhotos=options.uploadPhotos!==!1;options.cameraUploadServers&&options.cameraUploadServers.indexOf(server.Id)===-1&&(uploadPhotos=!1);var pr=Promise.resolve();return pr.then(function(){return uploadPhotos?uploadContent(connectionManager,server,options):Promise.resolve()}).then(function(){return syncMedia(connectionManager,server,options)})}function uploadContent(connectionManager,server,options){return new Promise(function(resolve,reject){require(["contentuploader"],function(ContentUploader){var uploader=new ContentUploader;uploader.uploadImages(connectionManager,server).then(resolve,reject)})})}function syncMedia(connectionManager,server,options){return new Promise(function(resolve,reject){require(["mediasync"],function(MediaSync){var apiClient=connectionManager.getApiClient(server.Id);(new MediaSync).sync(apiClient,server,options).then(resolve,reject)})})}function ServerSync(){}return ServerSync.prototype.sync=function(connectionManager,server,options){if(!server.AccessToken&&!server.ExchangeToken)return console.log("Skipping sync to server "+server.Id+" because there is no saved authentication information."),Promise.resolve();var connectionOptions={updateDateLastAccessed:!1,enableWebSocket:!1,reportCapabilities:!1,enableAutomaticBitrateDetection:!1};return connectionManager.connectToServer(server,connectionOptions).then(function(result){return result.State===MediaBrowser.ConnectionState.SignedIn?performSync(connectionManager,server,options):(console.log("Unable to connect to server id: "+server.Id),Promise.reject())},function(err){throw console.log("Unable to connect to server id: "+server.Id),err})},ServerSync}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js b/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js index 19652b6305..40e01daa5e 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js +++ b/dashboard-ui/bower_components/emby-webcomponents/browserdeviceprofile.js @@ -1 +1 @@ -define(["browser"],function(browser){"use strict";function canPlayH264(){var v=document.createElement("video");return!(!v.canPlayType||!v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""))}function canPlayH265(){if(browser.tizen||browser.orsay)return!0;var userAgent=navigator.userAgent.toLowerCase(),isChromecast=userAgent.indexOf("crkey")!==-1;if(isChromecast){var isChromecastUltra=userAgent.indexOf("aarch64")!==-1;if(isChromecastUltra)return!0}return!1}function supportsTextTracks(){return!(!browser.tizen&&!browser.orsay)||(null==_supportsTextTracks&&(_supportsTextTracks=null!=document.createElement("video").textTracks),_supportsTextTracks)}function canPlayHls(src){return null==_canPlayHls&&(_canPlayHls=canPlayNativeHls()||canPlayHlsWithMSE()),_canPlayHls}function canPlayNativeHls(){if(browser.tizen||browser.orsay)return!0;var media=document.createElement("video");return!(!media.canPlayType("application/x-mpegURL").replace(/no/,"")&&!media.canPlayType("application/vnd.apple.mpegURL").replace(/no/,""))}function canPlayHlsWithMSE(){return null!=window.MediaSource}function canPlayAudioFormat(format){var typeString;if("flac"===format){if(browser.tizen||browser.orsay)return!0;if(browser.edgeUwp)return!0}else if("wma"===format){if(browser.tizen||browser.orsay)return!0;if(browser.edgeUwp)return!0}else if("opus"===format)return typeString='audio/ogg; codecs="opus"',!!document.createElement("audio").canPlayType(typeString).replace(/no/,"");return typeString="webma"===format?"audio/webm":"audio/"+format,!!document.createElement("audio").canPlayType(typeString).replace(/no/,"")}function testCanPlayMkv(videoTestElement){if(browser.tizen||browser.orsay)return!0;if(videoTestElement.canPlayType("video/x-matroska")||videoTestElement.canPlayType("video/mkv"))return!0;var userAgent=navigator.userAgent.toLowerCase();return browser.chrome?!browser.operaTv&&(userAgent.indexOf("vivaldi")===-1&&userAgent.indexOf("opera")===-1):!!browser.edgeUwp}function testCanPlayTs(){return browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp}function supportsMpeg2Video(){return browser.orsay||browser.tizen||browser.edgeUwp}function supportsVc1(){return browser.orsay||browser.tizen||browser.edgeUwp}function getDirectPlayProfileForVideoContainer(container,videoAudioCodecs){var supported=!1,profileContainer=container,videoCodecs=[];switch(container){case"asf":supported=browser.tizen||browser.orsay||browser.edgeUwp,videoAudioCodecs=[];break;case"avi":supported=browser.tizen||browser.orsay||browser.edgeUwp;break;case"mpg":case"mpeg":supported=browser.edgeUwp||browser.tizen||browser.orsay;break;case"3gp":case"flv":case"mts":case"trp":case"vob":case"vro":supported=browser.tizen||browser.orsay;break;case"mov":supported=browser.tizen||browser.orsay||browser.chrome||browser.edgeUwp,videoCodecs.push("h264");break;case"m2ts":supported=browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp,videoCodecs.push("h264"),supportsVc1()&&videoCodecs.push("vc1"),supportsMpeg2Video()&&videoCodecs.push("mpeg2video");break;case"wmv":supported=browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp,videoAudioCodecs=[];break;case"ts":supported=testCanPlayTs(),videoCodecs.push("h264"),canPlayH265()&&(videoCodecs.push("h265"),videoCodecs.push("hevc")),supportsVc1()&&videoCodecs.push("vc1"),supportsMpeg2Video()&&videoCodecs.push("mpeg2video"),profileContainer="ts,mpegts"}return supported?{Container:profileContainer,Type:"Video",VideoCodec:videoCodecs.join(","),AudioCodec:videoAudioCodecs.join(",")}:null}function getMaxBitrate(){return 12e7}function getGlobalMaxVideoBitrate(){var userAgent=navigator.userAgent.toLowerCase(),isChromecast=userAgent.indexOf("crkey")!==-1;if(isChromecast){var isChromecastUltra=userAgent.indexOf("aarch64")!==-1;return isChromecastUltra?4e7:11e6}var isTizenFhd=!1;if(browser.tizen)try{var isTizenUhd=webapis.productinfo.isUdPanelSupported();isTizenFhd=!isTizenUhd,console.log("isTizenFhd = "+isTizenFhd)}catch(error){console.log("isUdPanelSupported() error code = "+error.code)}return browser.ps4?8e6:browser.xboxOne?12e6:browser.edgeUwp?4e7:browser.tizen&&isTizenFhd?2e7:null}function supportsAc3(videoTestElement){return!!(browser.edgeUwp||browser.tizen||browser.orsay||browser.web0s)||videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/,"")&&!browser.osx&&!browser.iOS}function supportsEac3(videoTestElement){return!!(browser.tizen||browser.orsay||browser.web0s)||videoTestElement.canPlayType('audio/mp4; codecs="ec-3"').replace(/no/,"")}var _supportsTextTracks,_canPlayHls;return function(options){options=options||{};var physicalAudioChannels=options.audioChannels||(browser.mobile?2:6),bitrateSetting=getMaxBitrate(),videoTestElement=document.createElement("video"),canPlayWebm=videoTestElement.canPlayType("video/webm").replace(/no/,""),canPlayMkv=testCanPlayMkv(videoTestElement),profile={};profile.MaxStreamingBitrate=bitrateSetting,profile.MaxStaticBitrate=1e8,profile.MusicStreamingTranscodingBitrate=Math.min(bitrateSetting,192e3),profile.DirectPlayProfiles=[];var videoAudioCodecs=[],hlsVideoAudioCodecs=[],supportsMp3VideoAudio=videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.69"').replace(/no/,"")||videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.6B"').replace(/no/,"");if(supportsAc3(videoTestElement)){videoAudioCodecs.push("ac3");var eAc3=supportsEac3(videoTestElement);eAc3&&videoAudioCodecs.push("eac3"),browser.edge&&browser.touch&&!browser.edgeUwp||(hlsVideoAudioCodecs.push("ac3"),eAc3&&hlsVideoAudioCodecs.push("eac3"))}var mp3Added=!1;canPlayMkv&&supportsMp3VideoAudio&&(mp3Added=!0,videoAudioCodecs.push("mp3")),videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/,"")&&(videoAudioCodecs.push("aac"),hlsVideoAudioCodecs.push("aac")),supportsMp3VideoAudio&&(mp3Added||videoAudioCodecs.push("mp3"),browser.ps4||hlsVideoAudioCodecs.push("mp3")),(browser.tizen||browser.orsay||options.supportsDts)&&(videoAudioCodecs.push("dca"),videoAudioCodecs.push("dts")),(browser.tizen||browser.orsay)&&(videoAudioCodecs.push("pcm_s16le"),videoAudioCodecs.push("pcm_s24le")),options.supportsTrueHd&&videoAudioCodecs.push("truehd"),videoAudioCodecs=videoAudioCodecs.filter(function(c){return(options.disableVideoAudioCodecs||[]).indexOf(c)===-1}),hlsVideoAudioCodecs=hlsVideoAudioCodecs.filter(function(c){return(options.disableHlsVideoAudioCodecs||[]).indexOf(c)===-1});var mp4VideoCodecs=[];canPlayH264()&&mp4VideoCodecs.push("h264"),canPlayH265()&&(mp4VideoCodecs.push("h265"),mp4VideoCodecs.push("hevc")),supportsMpeg2Video()&&mp4VideoCodecs.push("mpeg2video"),supportsVc1()&&mp4VideoCodecs.push("vc1"),(browser.tizen||browser.orsay)&&mp4VideoCodecs.push("msmpeg4v2"),mp4VideoCodecs.length&&profile.DirectPlayProfiles.push({Container:"mp4,m4v",Type:"Video",VideoCodec:mp4VideoCodecs.join(","),AudioCodec:videoAudioCodecs.join(",")}),canPlayMkv&&mp4VideoCodecs.length&&profile.DirectPlayProfiles.push({Container:"mkv",Type:"Video",VideoCodec:mp4VideoCodecs.join(","),AudioCodec:videoAudioCodecs.join(",")}),["m2ts","mov","wmv","ts","asf","avi","mpg","mpeg"].map(function(container){return getDirectPlayProfileForVideoContainer(container,videoAudioCodecs)}).filter(function(i){return null!=i}).forEach(function(i){profile.DirectPlayProfiles.push(i)}),["opus","mp3","aac","flac","alac","webma","wma","wav","ogg","oga"].filter(canPlayAudioFormat).forEach(function(audioFormat){profile.DirectPlayProfiles.push({Container:"webma"===audioFormat?"webma,webm":audioFormat,Type:"Audio"}),"aac"===audioFormat&&profile.DirectPlayProfiles.push({Container:"m4a",AudioCodec:audioFormat,Type:"Audio"})}),canPlayWebm&&profile.DirectPlayProfiles.push({Container:"webm",Type:"Video"}),profile.TranscodingProfiles=[],canPlayNativeHls()&&options.enableHlsAudio&&profile.TranscodingProfiles.push({Container:"ts",Type:"Audio",AudioCodec:"aac",Context:"Streaming",Protocol:"hls"}),["aac","mp3","opus","wav"].filter(canPlayAudioFormat).forEach(function(audioFormat){profile.TranscodingProfiles.push({Container:audioFormat,Type:"Audio",AudioCodec:audioFormat,Context:"Streaming",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()})}),["opus","mp3","aac","wav"].filter(canPlayAudioFormat).forEach(function(audioFormat){profile.TranscodingProfiles.push({Container:audioFormat,Type:"Audio",AudioCodec:audioFormat,Context:"Static",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()})}),!canPlayMkv||browser.tizen||browser.orsay||options.enableMkvProgressive===!1||profile.TranscodingProfiles.push({Container:"mkv",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:mp4VideoCodecs.join(","),Context:"Streaming",MaxAudioChannels:physicalAudioChannels.toString(),CopyTimestamps:!0}),canPlayMkv&&profile.TranscodingProfiles.push({Container:"mkv",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:"h264",Context:"Static",MaxAudioChannels:physicalAudioChannels.toString(),CopyTimestamps:!0}),canPlayHls()&&options.enableHls!==!1&&profile.TranscodingProfiles.push({Container:"ts",Type:"Video",AudioCodec:hlsVideoAudioCodecs.join(","),VideoCodec:"h264",Context:"Streaming",Protocol:"hls",MaxAudioChannels:physicalAudioChannels.toString(),MinSegments:(browser.iOS||browser.osx,"2"),BreakOnNonKeyFrames:!(!browser.iOS&&!browser.osx)}),canPlayWebm&&profile.TranscodingProfiles.push({Container:"webm",Type:"Video",AudioCodec:"vorbis",VideoCodec:"vpx",Context:"Streaming",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()}),profile.TranscodingProfiles.push({Container:"mp4",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:"h264",Context:"Streaming",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()}),profile.TranscodingProfiles.push({Container:"mp4",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:"h264",Context:"Static",Protocol:"http"}),profile.ContainerProfiles=[],profile.CodecProfiles=[];var supportsSecondaryAudio=browser.tizen||browser.orsay||browser.edge||browser.msie;videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.5"').replace(/no/,"")||(profile.CodecProfiles.push({Type:"VideoAudio",Codec:"aac",Conditions:[{Condition:"NotEquals",Property:"AudioProfile",Value:"HE-AAC"},{Condition:"LessThanEqual",Property:"AudioBitrate",Value:"128000"}]}),supportsSecondaryAudio||profile.CodecProfiles[profile.CodecProfiles.length-1].Conditions.push({Condition:"Equals",Property:"IsSecondaryAudio",Value:"false",IsRequired:"false"})),supportsSecondaryAudio||profile.CodecProfiles.push({Type:"VideoAudio",Conditions:[{Condition:"Equals",Property:"IsSecondaryAudio",Value:"false",IsRequired:"false"}]}),profile.CodecProfiles.push({Type:"Video",Codec:"h264",Conditions:[{Condition:"NotEquals",Property:"IsAnamorphic",Value:"true",IsRequired:!1},{Condition:"EqualsAny",Property:"VideoProfile",Value:"high|main|baseline|constrained baseline"},{Condition:"LessThanEqual",Property:"VideoLevel",Value:"51"}]}),browser.edgeUwp||browser.tizen||browser.orsay||browser.web0s||profile.CodecProfiles[profile.CodecProfiles.length-1].Conditions.push({Condition:"NotEquals",Property:"IsAVC",Value:"false",IsRequired:!1});var globalMaxVideoBitrate=(getGlobalMaxVideoBitrate()||"").toString(),h264MaxVideoBitrate=globalMaxVideoBitrate;return h264MaxVideoBitrate&&profile.CodecProfiles[profile.CodecProfiles.length-1].Conditions.push({Condition:"LessThanEqual",Property:"VideoBitrate",Value:h264MaxVideoBitrate,IsRequired:!0}),globalMaxVideoBitrate&&profile.CodecProfiles.push({Type:"Video",Conditions:[{Condition:"LessThanEqual",Property:"VideoBitrate",Value:globalMaxVideoBitrate}]}),profile.SubtitleProfiles=[],supportsTextTracks()&&profile.SubtitleProfiles.push({Format:"vtt",Method:"External"}),profile.ResponseProfiles=[],profile.ResponseProfiles.push({Type:"Video",Container:"m4v",MimeType:"video/mp4"}),browser.chrome&&profile.ResponseProfiles.push({Type:"Video",Container:"mov",MimeType:"video/webm"}),profile}}); \ No newline at end of file +define(["browser"],function(browser){"use strict";function canPlayH264(videoTestElement){return!(!videoTestElement.canPlayType||!videoTestElement.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""))}function canPlayH265(videoTestElement){if(browser.tizen||browser.orsay)return!0;var userAgent=navigator.userAgent.toLowerCase(),isChromecast=userAgent.indexOf("crkey")!==-1;if(isChromecast){var isChromecastUltra=userAgent.indexOf("aarch64")!==-1;if(isChromecastUltra)return!0}return!(!videoTestElement.canPlayType||!videoTestElement.canPlayType('video/hevc; codecs="hevc, aac"').replace(/no/,""))}function supportsTextTracks(){return!(!browser.tizen&&!browser.orsay)||(null==_supportsTextTracks&&(_supportsTextTracks=null!=document.createElement("video").textTracks),_supportsTextTracks)}function canPlayHls(src){return null==_canPlayHls&&(_canPlayHls=canPlayNativeHls()||canPlayHlsWithMSE()),_canPlayHls}function canPlayNativeHls(){if(browser.tizen||browser.orsay)return!0;var media=document.createElement("video");return!(!media.canPlayType("application/x-mpegURL").replace(/no/,"")&&!media.canPlayType("application/vnd.apple.mpegURL").replace(/no/,""))}function canPlayHlsWithMSE(){return null!=window.MediaSource}function canPlayAudioFormat(format){var typeString;if("flac"===format){if(browser.tizen||browser.orsay)return!0;if(browser.edgeUwp)return!0}else if("wma"===format){if(browser.tizen||browser.orsay)return!0;if(browser.edgeUwp)return!0}else if("opus"===format)return typeString='audio/ogg; codecs="opus"',!!document.createElement("audio").canPlayType(typeString).replace(/no/,"");return typeString="webma"===format?"audio/webm":"audio/"+format,!!document.createElement("audio").canPlayType(typeString).replace(/no/,"")}function testCanPlayMkv(videoTestElement){if(browser.tizen||browser.orsay)return!0;if(videoTestElement.canPlayType("video/x-matroska").replace(/no/,"")||videoTestElement.canPlayType("video/mkv").replace(/no/,""))return!0;var userAgent=navigator.userAgent.toLowerCase();return browser.chrome?!browser.operaTv&&(userAgent.indexOf("vivaldi")===-1&&userAgent.indexOf("opera")===-1):!!browser.edgeUwp}function testCanPlayTs(){return browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp}function supportsMpeg2Video(){return browser.orsay||browser.tizen||browser.edgeUwp}function supportsVc1(){return browser.orsay||browser.tizen||browser.edgeUwp}function getDirectPlayProfileForVideoContainer(container,videoAudioCodecs,videoTestElement){var supported=!1,profileContainer=container,videoCodecs=[];switch(container){case"asf":supported=browser.tizen||browser.orsay||browser.edgeUwp,videoAudioCodecs=[];break;case"avi":supported=browser.tizen||browser.orsay||browser.edgeUwp;break;case"mpg":case"mpeg":supported=browser.edgeUwp||browser.tizen||browser.orsay;break;case"3gp":case"flv":case"mts":case"trp":case"vob":case"vro":supported=browser.tizen||browser.orsay;break;case"mov":supported=browser.tizen||browser.orsay||browser.chrome||browser.edgeUwp,videoCodecs.push("h264");break;case"m2ts":supported=browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp,videoCodecs.push("h264"),supportsVc1()&&videoCodecs.push("vc1"),supportsMpeg2Video()&&videoCodecs.push("mpeg2video");break;case"wmv":supported=browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp,videoAudioCodecs=[];break;case"ts":supported=testCanPlayTs(),videoCodecs.push("h264"),canPlayH265(videoTestElement)&&(videoCodecs.push("h265"),videoCodecs.push("hevc")),supportsVc1()&&videoCodecs.push("vc1"),supportsMpeg2Video()&&videoCodecs.push("mpeg2video"),profileContainer="ts,mpegts"}return supported?{Container:profileContainer,Type:"Video",VideoCodec:videoCodecs.join(","),AudioCodec:videoAudioCodecs.join(",")}:null}function getMaxBitrate(){return 12e7}function getGlobalMaxVideoBitrate(){var userAgent=navigator.userAgent.toLowerCase(),isChromecast=userAgent.indexOf("crkey")!==-1;if(isChromecast){var isChromecastUltra=userAgent.indexOf("aarch64")!==-1;return isChromecastUltra?4e7:11e6}var isTizenFhd=!1;if(browser.tizen)try{var isTizenUhd=webapis.productinfo.isUdPanelSupported();isTizenFhd=!isTizenUhd,console.log("isTizenFhd = "+isTizenFhd)}catch(error){console.log("isUdPanelSupported() error code = "+error.code)}return browser.ps4?8e6:browser.xboxOne?12e6:browser.edgeUwp?4e7:browser.tizen&&isTizenFhd?2e7:null}function supportsAc3(videoTestElement){return!!(browser.edgeUwp||browser.tizen||browser.orsay||browser.web0s)||videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/,"")&&!browser.osx&&!browser.iOS}function supportsEac3(videoTestElement){return!!(browser.tizen||browser.orsay||browser.web0s)||videoTestElement.canPlayType('audio/mp4; codecs="ec-3"').replace(/no/,"")}var _supportsTextTracks,_canPlayHls;return function(options){options=options||{};var physicalAudioChannels=options.audioChannels||(browser.mobile?2:6),bitrateSetting=getMaxBitrate(),videoTestElement=document.createElement("video"),canPlayWebm=videoTestElement.canPlayType("video/webm").replace(/no/,""),canPlayMkv=testCanPlayMkv(videoTestElement),profile={};profile.MaxStreamingBitrate=bitrateSetting,profile.MaxStaticBitrate=1e8,profile.MusicStreamingTranscodingBitrate=Math.min(bitrateSetting,192e3),profile.DirectPlayProfiles=[];var videoAudioCodecs=[],hlsVideoAudioCodecs=[],supportsMp3VideoAudio=videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.69"').replace(/no/,"")||videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.6B"').replace(/no/,"");if(supportsAc3(videoTestElement)){videoAudioCodecs.push("ac3");var eAc3=supportsEac3(videoTestElement);eAc3&&videoAudioCodecs.push("eac3"),browser.edge&&browser.touch&&!browser.edgeUwp||(hlsVideoAudioCodecs.push("ac3"),eAc3&&hlsVideoAudioCodecs.push("eac3"))}var mp3Added=!1;canPlayMkv&&supportsMp3VideoAudio&&(mp3Added=!0,videoAudioCodecs.push("mp3")),videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/,"")&&(videoAudioCodecs.push("aac"),hlsVideoAudioCodecs.push("aac")),supportsMp3VideoAudio&&(mp3Added||videoAudioCodecs.push("mp3"),browser.ps4||hlsVideoAudioCodecs.push("mp3")),(browser.tizen||browser.orsay||options.supportsDts)&&(videoAudioCodecs.push("dca"),videoAudioCodecs.push("dts")),(browser.tizen||browser.orsay)&&(videoAudioCodecs.push("pcm_s16le"),videoAudioCodecs.push("pcm_s24le")),options.supportsTrueHd&&videoAudioCodecs.push("truehd"),videoAudioCodecs=videoAudioCodecs.filter(function(c){return(options.disableVideoAudioCodecs||[]).indexOf(c)===-1}),hlsVideoAudioCodecs=hlsVideoAudioCodecs.filter(function(c){return(options.disableHlsVideoAudioCodecs||[]).indexOf(c)===-1});var mp4VideoCodecs=[];canPlayH264(videoTestElement)&&mp4VideoCodecs.push("h264"),canPlayH265(videoTestElement)&&(mp4VideoCodecs.push("h265"),mp4VideoCodecs.push("hevc")),supportsMpeg2Video()&&mp4VideoCodecs.push("mpeg2video"),supportsVc1()&&mp4VideoCodecs.push("vc1"),(browser.tizen||browser.orsay)&&mp4VideoCodecs.push("msmpeg4v2"),mp4VideoCodecs.length&&profile.DirectPlayProfiles.push({Container:"mp4,m4v",Type:"Video",VideoCodec:mp4VideoCodecs.join(","),AudioCodec:videoAudioCodecs.join(",")}),canPlayMkv&&mp4VideoCodecs.length&&profile.DirectPlayProfiles.push({Container:"mkv",Type:"Video",VideoCodec:mp4VideoCodecs.join(","),AudioCodec:videoAudioCodecs.join(",")}),["m2ts","mov","wmv","ts","asf","avi","mpg","mpeg"].map(function(container){return getDirectPlayProfileForVideoContainer(container,videoAudioCodecs,videoTestElement)}).filter(function(i){return null!=i}).forEach(function(i){profile.DirectPlayProfiles.push(i)}),["opus","mp3","aac","flac","alac","webma","wma","wav","ogg","oga"].filter(canPlayAudioFormat).forEach(function(audioFormat){profile.DirectPlayProfiles.push({Container:"webma"===audioFormat?"webma,webm":audioFormat,Type:"Audio"}),"aac"===audioFormat&&profile.DirectPlayProfiles.push({Container:"m4a",AudioCodec:audioFormat,Type:"Audio"})}),canPlayWebm&&profile.DirectPlayProfiles.push({Container:"webm",Type:"Video"}),profile.TranscodingProfiles=[],canPlayNativeHls()&&options.enableHlsAudio&&profile.TranscodingProfiles.push({Container:"ts",Type:"Audio",AudioCodec:"aac",Context:"Streaming",Protocol:"hls"}),["aac","mp3","opus","wav"].filter(canPlayAudioFormat).forEach(function(audioFormat){profile.TranscodingProfiles.push({Container:audioFormat,Type:"Audio",AudioCodec:audioFormat,Context:"Streaming",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()})}),["opus","mp3","aac","wav"].filter(canPlayAudioFormat).forEach(function(audioFormat){profile.TranscodingProfiles.push({Container:audioFormat,Type:"Audio",AudioCodec:audioFormat,Context:"Static",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()})}),!canPlayMkv||browser.tizen||browser.orsay||options.enableMkvProgressive===!1||profile.TranscodingProfiles.push({Container:"mkv",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:mp4VideoCodecs.join(","),Context:"Streaming",MaxAudioChannels:physicalAudioChannels.toString(),CopyTimestamps:!0}),canPlayMkv&&profile.TranscodingProfiles.push({Container:"mkv",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:"h264",Context:"Static",MaxAudioChannels:physicalAudioChannels.toString(),CopyTimestamps:!0}),canPlayHls()&&options.enableHls!==!1&&profile.TranscodingProfiles.push({Container:"ts",Type:"Video",AudioCodec:hlsVideoAudioCodecs.join(","),VideoCodec:"h264",Context:"Streaming",Protocol:"hls",MaxAudioChannels:physicalAudioChannels.toString(),MinSegments:(browser.iOS||browser.osx,"2"),BreakOnNonKeyFrames:!(!browser.iOS&&!browser.osx)}),canPlayWebm&&profile.TranscodingProfiles.push({Container:"webm",Type:"Video",AudioCodec:"vorbis",VideoCodec:"vpx",Context:"Streaming",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()}),profile.TranscodingProfiles.push({Container:"mp4",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:"h264",Context:"Streaming",Protocol:"http",MaxAudioChannels:physicalAudioChannels.toString()}),profile.TranscodingProfiles.push({Container:"mp4",Type:"Video",AudioCodec:videoAudioCodecs.join(","),VideoCodec:"h264",Context:"Static",Protocol:"http"}),profile.ContainerProfiles=[],profile.CodecProfiles=[];var supportsSecondaryAudio=browser.tizen||browser.orsay||browser.edge||browser.msie;videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.5"').replace(/no/,"")||(profile.CodecProfiles.push({Type:"VideoAudio",Codec:"aac",Conditions:[{Condition:"NotEquals",Property:"AudioProfile",Value:"HE-AAC"},{Condition:"LessThanEqual",Property:"AudioBitrate",Value:"128000"}]}),supportsSecondaryAudio||profile.CodecProfiles[profile.CodecProfiles.length-1].Conditions.push({Condition:"Equals",Property:"IsSecondaryAudio",Value:"false",IsRequired:"false"})),supportsSecondaryAudio||profile.CodecProfiles.push({Type:"VideoAudio",Conditions:[{Condition:"Equals",Property:"IsSecondaryAudio",Value:"false",IsRequired:"false"}]}),profile.CodecProfiles.push({Type:"Video",Codec:"h264",Conditions:[{Condition:"NotEquals",Property:"IsAnamorphic",Value:"true",IsRequired:!1},{Condition:"EqualsAny",Property:"VideoProfile",Value:"high|main|baseline|constrained baseline"},{Condition:"LessThanEqual",Property:"VideoLevel",Value:"51"}]}),browser.edgeUwp||browser.tizen||browser.orsay||browser.web0s||profile.CodecProfiles[profile.CodecProfiles.length-1].Conditions.push({Condition:"NotEquals",Property:"IsAVC",Value:"false",IsRequired:!1});var globalMaxVideoBitrate=(getGlobalMaxVideoBitrate()||"").toString(),h264MaxVideoBitrate=globalMaxVideoBitrate;return h264MaxVideoBitrate&&profile.CodecProfiles[profile.CodecProfiles.length-1].Conditions.push({Condition:"LessThanEqual",Property:"VideoBitrate",Value:h264MaxVideoBitrate,IsRequired:!0}),globalMaxVideoBitrate&&profile.CodecProfiles.push({Type:"Video",Conditions:[{Condition:"LessThanEqual",Property:"VideoBitrate",Value:globalMaxVideoBitrate}]}),profile.SubtitleProfiles=[],supportsTextTracks()&&profile.SubtitleProfiles.push({Format:"vtt",Method:"External"}),profile.ResponseProfiles=[],profile.ResponseProfiles.push({Type:"Video",Container:"m4v",MimeType:"video/mp4"}),browser.chrome&&profile.ResponseProfiles.push({Type:"Video",Container:"mov",MimeType:"video/webm"}),profile}}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css index cc064c635e..a9cd45d240 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.css @@ -1 +1 @@ -.tvGuideHeader,.tvguide{display:-webkit-box;display:-webkit-flex}.channelPrograms,.programContainer,.timeslotHeaders,.tvGuideHeader,.tvProgram{white-space:nowrap}.channelPrograms,.programContainer,.timeslotHeadersInner,.tvProgram{position:relative}.channelHeaderCell,.channelTimeslotHeader,.guideChannelName,.guideChannelNumber,.guideProgramName,.guideProgramNameText{-o-text-overflow:ellipsis;text-overflow:ellipsis}.channelPrograms,.channelsContainer,.tvGuideHeader,.tvguide{-webkit-box-orient:vertical;-webkit-box-direction:normal}.tvguide{display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:initial;-webkit-align-items:initial;align-items:initial}.tvGuideHeader{width:100%;-webkit-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;flex-shrink:0;display:flex;min-height:5.6em}.guideHeaderDateSelection{font-size:86%;padding:.4em 0}.guideHeaderTimeslots{display:-webkit-box;display:-webkit-flex;display:flex;color:#ccc}.tvProgramSectionHeader{margin:0}.tvProgram{display:block;text-decoration:none}.guideProgramIndicator{text-transform:uppercase;-webkit-border-radius:.25em;border-radius:.25em;margin-right:.5em;font-size:74%;padding:.08em .25em;display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;text-align:center;color:#fff}.channelTimeslotHeader{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;border-right-color:transparent}.programContainer{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.channelPrograms{-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:.3em}.currentTimeIndicatorBar{position:absolute;bottom:.05em;left:0;width:100%;display:-webkit-box;display:-webkit-flex;display:flex;margin-left:.25em;background-color:#52B54B;height:2px;-webkit-transform-origin:left;transform-origin:left;-webkit-transition:-webkit-transform .5s ease-out;-o-transition:transform .5s ease-out;transition:transform .5s ease-out}.currentTimeIndicatorArrowContainer{position:absolute;bottom:-.4em;color:#52B54B;margin-left:.25em;-webkit-transform-origin:left;transform-origin:left;-webkit-transition:-webkit-transform .5s ease-out;-o-transition:transform .5s ease-out;transition:transform .5s ease-out}.currentTimeIndicatorArrow{width:1em;height:1em;font-size:1.2em;color:#52B54B;margin-left:-.52em}.guideSpacer{width:.3em;-webkit-flex-shrink:0;flex-shrink:0}.channelPrograms,.timeslotHeadersInner{width:1800vw}@media all and (min-width:37.5em){.channelPrograms,.timeslotHeadersInner{width:1400vw}}@media all and (min-width:50em){.channelPrograms,.timeslotHeadersInner{width:1200vw}}@media all and (min-width:80em){.channelPrograms,.timeslotHeadersInner{width:810vw}}.timeslotHeader{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-indent:.35em}.channelHeaderCell,.channelTimeslotHeader{overflow:hidden;margin-right:1px;background:#2e2e2e;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-decoration:none;text-align:left;contain:strict;-webkit-flex-shrink:0;flex-shrink:0;-webkit-border-radius:.3em;border-radius:.3em}.channelTimeslotHeader,.channelsContainer{width:24vw}.channelHeaderCell{width:100%}@media all and (min-width:31.25em){.channelTimeslotHeader,.channelsContainer{width:16vw}}@media all and (min-width:37.5em){.channelTimeslotHeader,.channelsContainer{width:16vw}}@media all and (min-width:50em){.channelTimeslotHeader,.channelsContainer{width:14vw}}@media all and (min-width:80em){.channelTimeslotHeader,.channelsContainer{width:12vw}}.btnGuideViewSettings{margin:0;-webkit-flex-shrink:0;flex-shrink:0}.btnGuideViewSettingsIcon{font-size:1.5em!important}.selectDateIcon{-webkit-flex-shrink:0;flex-shrink:0}.channelHeaderCell{-webkit-background-size:auto 70%;background-size:auto 70%;background-position:92% center;background-repeat:no-repeat;margin-bottom:.3em}@media all and (max-width:50em){.guideHdIcon,.liveTvProgram,.newTvProgram,.premiereTvProgram{display:none}}.channelHeaderCell,.channelPrograms{height:4.2em;contain:strict}.channelPrograms{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column}.programCell,.programCellInner{display:-webkit-box;display:-webkit-flex;top:0;position:absolute;bottom:0;overflow:hidden}.channelHeaderCell-tv,.channelPrograms-tv{height:3.4em}.channelTimeslotHeader,.timeslotHeader{background:0 0;height:2.2em}.programGrid{padding-bottom:4px;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.timeslotHeader{width:2.0833333333333333333333333333333%}.programCell{display:flex;text-decoration:none;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-align:left;contain:strict;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;margin:0!important;padding:0!important}.programCellInner{margin-right:.3em;background-color:#202020;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;-webkit-border-radius:.3em;border-radius:.3em;left:0;right:0;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.guideProgramName,.guideProgramNameCaret{display:-webkit-box;display:-webkit-flex;-webkit-box-align:center}.programAccent{position:absolute;bottom:0;left:0;right:0;height:2px}.sportsAccent{background-color:#3949AB}.movieAccent{background-color:#5E35B1}.childAccent{background-color:#039BE5}.newsAccent{background-color:#43A047}.specialsAccent{background-color:#FB8C00}.guideProgramName{padding:0 .5em;overflow:hidden;-webkit-align-items:center;align-items:center;display:flex;position:relative;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.guideProgramNameCaret{display:flex;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;color:#777;font-size:200%}.guideProgramNameText{margin:0;font-weight:400;overflow:hidden}.guideProgramSecondaryInfo{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin-top:.1em}.programSecondaryTitle{color:#888}.programIcon{margin-left:.5em;height:1em;width:1em;font-size:1.6em;color:#ddd;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.programTextIcon{font-weight:700;color:#1e1e1e;font-size:.9em;background:#555;padding:.16em .3em;-webkit-border-radius:.25em;border-radius:.25em;margin-right:.35em;width:auto;height:auto}.programTextIcon-tv{font-size:.74em}.guideChannelNumber{padding-left:1em;max-width:30%;overflow:hidden;font-weight:400;margin:0}.guideChannelName{margin-left:auto;margin-right:1em;overflow:hidden;max-width:70%}@media all and (min-width:62.5em){.guideChannelName{max-width:40%}}@media all and (max-width:62.5em){.guideChannelNumber{display:none}}.channelsContainer{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;-webkit-flex-direction:column;flex-direction:column}.channelsContainer,.programGrid{contain:layout style}.channelHeaderCell,.programCell{outline:0!important}.channelHeaderCell:focus,.programCell:focus>.programCellInner{background-color:#555}.seriesTimerIcon,.timerIcon{color:#c33!important}.seriesTimerIcon-inactive{color:inherit!important;opacity:.7}.guideOptions{color:#eee;-webkit-flex-shrink:0;flex-shrink:0;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}@media all and (max-width:50em),all and (max-height:37.5em){.tvGuideHeader{padding-left:0}}.guideRequiresUnlock{margin:1em auto;text-align:center;padding:1em;-webkit-flex-shrink:0;flex-shrink:0}.noRubberBanding{padding-bottom:100px}.guideDateTabsSlider{text-align:center}.guide-date-tab-button{color:#555!important;padding:.3em .7em!important;margin:0 .3em!important}.guide-date-tab-button.emby-tab-button-active{color:#52B54B!important;border-color:transparent!important}.guide-date-tab-button:focus{color:#52B54B!important}.guide-date-tab-button.emby-button-tv:focus{background-color:#52B54B!important;-webkit-border-radius:.15em!important;border-radius:.15em!important;color:#fff!important;-webkit-transform:none!important;transform:none!important} \ No newline at end of file +.tvGuideHeader,.tvguide{display:-webkit-box;display:-webkit-flex}.channelPrograms,.programContainer,.timeslotHeaders,.tvGuideHeader,.tvProgram{white-space:nowrap}.channelPrograms,.programContainer,.timeslotHeadersInner,.tvProgram{position:relative}.channelHeaderCell,.channelTimeslotHeader,.guideChannelName,.guideChannelNumber,.guideProgramName,.guideProgramNameText{-o-text-overflow:ellipsis;text-overflow:ellipsis}.channelPrograms,.channelsContainer,.tvGuideHeader,.tvguide{-webkit-box-orient:vertical;-webkit-box-direction:normal}.tvguide{display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:initial;-webkit-align-items:initial;align-items:initial}.tvGuideHeader{width:100%;-webkit-flex-direction:column;flex-direction:column;-webkit-flex-shrink:0;flex-shrink:0;display:flex;min-height:5.6em}.guideHeaderDateSelection{font-size:86%;padding:.4em 0}.guideHeaderTimeslots{display:-webkit-box;display:-webkit-flex;display:flex;color:#ccc}.tvProgramSectionHeader{margin:0}.tvProgram{display:block;text-decoration:none}.guideProgramIndicator{text-transform:uppercase;-webkit-border-radius:.25em;border-radius:.25em;margin-right:.5em;font-size:74%;padding:.08em .25em;display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;text-align:center;color:#fff}.channelTimeslotHeader{-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;border-right-color:transparent}.programContainer{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.channelPrograms{-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:.3em}.currentTimeIndicatorBar{position:absolute;bottom:.05em;left:0;width:100%;display:-webkit-box;display:-webkit-flex;display:flex;margin-left:.25em;background-color:#52B54B;height:2px;-webkit-transform-origin:left;transform-origin:left;-webkit-transition:-webkit-transform .5s ease-out;-o-transition:transform .5s ease-out;transition:transform .5s ease-out}.currentTimeIndicatorArrowContainer{position:absolute;bottom:-.4em;color:#52B54B;margin-left:.25em;-webkit-transform-origin:left;transform-origin:left;-webkit-transition:-webkit-transform .5s ease-out;-o-transition:transform .5s ease-out;transition:transform .5s ease-out}.currentTimeIndicatorArrow{width:1em;height:1em;font-size:1.2em;color:#52B54B;margin-left:-.52em}.guideSpacer{width:.3em;-webkit-flex-shrink:0;flex-shrink:0}.channelPrograms,.timeslotHeadersInner{width:1800vw}@media all and (min-width:37.5em){.channelPrograms,.timeslotHeadersInner{width:1400vw}}@media all and (min-width:50em){.channelPrograms,.timeslotHeadersInner{width:1200vw}}@media all and (min-width:80em){.channelPrograms,.timeslotHeadersInner{width:810vw}}.timeslotHeader{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-indent:.35em}.channelHeaderCell,.channelTimeslotHeader{overflow:hidden;margin-right:1px;background:#2e2e2e;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-decoration:none;text-align:left;contain:strict;-webkit-flex-shrink:0;flex-shrink:0;-webkit-border-radius:.3em;border-radius:.3em}.channelTimeslotHeader,.channelsContainer{width:24vw}.channelHeaderCell{width:100%}@media all and (min-width:31.25em){.channelTimeslotHeader,.channelsContainer{width:16vw}}@media all and (min-width:37.5em){.channelTimeslotHeader,.channelsContainer{width:16vw}}@media all and (min-width:50em){.channelTimeslotHeader,.channelsContainer{width:14vw}}@media all and (min-width:80em){.channelTimeslotHeader,.channelsContainer{width:12vw}}.btnGuideViewSettings{margin:0;-webkit-flex-shrink:0;flex-shrink:0}.btnGuideViewSettingsIcon{font-size:1.5em!important}.selectDateIcon{-webkit-flex-shrink:0;flex-shrink:0}.channelHeaderCell{-webkit-background-size:auto 70%;background-size:auto 70%;background-position:92% center;background-repeat:no-repeat;margin-bottom:.3em}@media all and (max-width:50em){.guideHdIcon,.liveTvProgram,.newTvProgram,.premiereTvProgram{display:none}}.channelHeaderCell,.channelPrograms{height:4.2em;contain:strict}.channelPrograms{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column}.programCell,.programCellInner{display:-webkit-box;display:-webkit-flex;top:0;position:absolute;bottom:0;overflow:hidden}.channelHeaderCell-tv,.channelPrograms-tv{height:3.4em}.channelTimeslotHeader,.timeslotHeader{background:0 0;height:2.2em}.programGrid{padding-bottom:4px;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.timeslotHeader{width:2.0833333333333333333333333333333%}.programCell{display:flex;text-decoration:none;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-align:left;contain:strict;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;margin:0!important;padding:0!important}.programCellInner{margin-right:.3em;background-color:#202020;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;-webkit-border-radius:.3em;border-radius:.3em;left:0;right:0;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.guideProgramName,.guideProgramNameCaret{display:-webkit-box;display:-webkit-flex;-webkit-box-align:center}.programAccent{position:absolute;bottom:0;left:0;right:0;height:2px}.sportsAccent{background-color:#3949AB}.movieAccent{background-color:#5E35B1}.childAccent{background-color:#039BE5}.newsAccent{background-color:#43A047}.specialsAccent{background-color:#FB8C00}.guideProgramName{padding:0 .5em;overflow:hidden;-webkit-align-items:center;align-items:center;display:flex;position:relative;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.guideProgramNameCaret{display:flex;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;color:#666;font-size:200%}.guideProgramNameText{margin:0;font-weight:400;overflow:hidden}.guideProgramSecondaryInfo{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin-top:.1em}.programSecondaryTitle{color:#888}.programIcon{margin-left:.5em;height:1em;width:1em;font-size:1.6em;color:#ddd;-webkit-flex-shrink:0;flex-shrink:0;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.programTextIcon{font-weight:700;color:#1e1e1e;font-size:.9em;background:#555;padding:.16em .3em;-webkit-border-radius:.25em;border-radius:.25em;margin-right:.35em;width:auto;height:auto}.programTextIcon-tv{font-size:.74em}.guideChannelNumber{padding-left:1em;max-width:30%;overflow:hidden;font-weight:400;margin:0}.guideChannelName{margin-left:auto;margin-right:1em;overflow:hidden;max-width:70%}@media all and (min-width:62.5em){.guideChannelName{max-width:40%}}@media all and (max-width:62.5em){.guideChannelNumber{display:none}}.channelsContainer{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-shrink:0;flex-shrink:0;-webkit-flex-direction:column;flex-direction:column;color:#ddd}.channelsContainer,.programGrid{contain:layout style}.channelHeaderCell,.programCell{outline:0!important}.channelHeaderCell:focus,.programCell:focus>.programCellInner{background-color:#555}.seriesTimerIcon,.timerIcon{color:#c33!important}.seriesTimerIcon-inactive{color:inherit!important;opacity:.7}.guideOptions{color:#eee;-webkit-flex-shrink:0;flex-shrink:0;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}@media all and (max-width:50em),all and (max-height:37.5em){.tvGuideHeader{padding-left:0}}.guideRequiresUnlock{margin:1em auto;text-align:center;padding:1em;-webkit-flex-shrink:0;flex-shrink:0}.noRubberBanding{padding-bottom:100px}.guideDateTabsSlider{text-align:center}.guide-date-tab-button{color:#555!important;padding:.3em .7em!important;margin:0 .3em!important}.guide-date-tab-button.emby-tab-button-active{color:#52B54B!important;border-color:transparent!important}.guide-date-tab-button:focus{color:#52B54B!important}.guide-date-tab-button.emby-button-tv:focus{background-color:#52B54B!important;-webkit-border-radius:.15em!important;border-radius:.15em!important;color:#fff!important;-webkit-transform:none!important;transform:none!important} \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js index 520b5327f4..dd338d2d23 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js +++ b/dashboard-ui/bower_components/emby-webcomponents/guide/guide.js @@ -1 +1 @@ -define(["require","inputManager","browser","globalize","connectionManager","scrollHelper","serverNotifications","loading","datetime","focusManager","userSettings","imageLoader","events","layoutManager","itemShortcuts","registrationServices","dom","clearButtonStyle","css!./guide.css","programStyles","material-icons","scrollStyles","emby-button","paper-icon-button-light","emby-tabs","emby-scroller","flexStyles","registerElement"],function(require,inputManager,browser,globalize,connectionManager,scrollHelper,serverNotifications,loading,datetime,focusManager,userSettings,imageLoader,events,layoutManager,itemShortcuts,registrationServices,dom){"use strict";function showViewSettings(instance){require(["guide-settings-dialog"],function(guideSettingsDialog){guideSettingsDialog.show(instance.categoryOptions).then(function(){instance.refresh()})})}function updateProgramCellOnScroll(cell,scrollPct){var left=cell.posLeft;left||(left=parseFloat(cell.style.left.replace("%","")),cell.posLeft=left);var width=cell.posWidth;width||(width=parseFloat(cell.style.width.replace("%","")),cell.posWidth=width);var right=left+width,newPct=Math.max(Math.min(scrollPct,right),left),offset=newPct-left,pctOfWidth=offset/width*100,guideProgramName=cell.guideProgramName;guideProgramName||(guideProgramName=cell.querySelector(".guideProgramName"),cell.guideProgramName=guideProgramName);var caret=cell.caret;caret||(caret=cell.querySelector(".guideProgramNameCaret"),cell.caret=caret),guideProgramName&&(pctOfWidth>0?(guideProgramName.style.transform="translateX("+pctOfWidth+"%)",caret.classList.remove("hide")):(guideProgramName.style.transform="none",caret.classList.add("hide")))}function updateProgramCellsOnScroll(programGrid,programCells){isUpdatingProgramCellScroll||(isUpdatingProgramCellScroll=!0,requestAnimationFrame(function(){for(var scrollLeft=programGrid.scrollLeft,scrollPct=scrollLeft?scrollLeft/programGrid.scrollWidth*100:0,i=0,length=programCells.length;i=0?date.setHours(date.getHours(),cellCurationMinutes,0,0):date.setHours(date.getHours(),0,0,0),date}function showLoading(){loading.show()}function hideLoading(){loading.hide()}function startCurrentTimeUpdateInterval(){clearCurrentTimeUpdateInterval(),currentTimeUpdateInterval=setInterval(updateCurrentTimeIndicator,6e4),updateCurrentTimeIndicator()}function clearCurrentTimeUpdateInterval(){var interval=currentTimeUpdateInterval;interval&&clearInterval(interval),currentTimeUpdateInterval=null,currentTimeIndicatorBar=null,currentTimeIndicatorArrow=null}function updateCurrentTimeIndicator(){if(currentTimeIndicatorBar||(currentTimeIndicatorBar=options.element.querySelector(".currentTimeIndicatorBar")),currentTimeIndicatorArrow||(currentTimeIndicatorArrow=options.element.querySelector(".currentTimeIndicatorArrowContainer")),currentDate){var dateDifference=(new Date).getTime()-currentDate.getTime(),pct=dateDifference>0?dateDifference/totalRendererdMs:0;pct=Math.min(pct,1),pct<=0||pct>=1?(currentTimeIndicatorBar.classList.add("hide"),currentTimeIndicatorArrow.classList.add("hide")):(currentTimeIndicatorBar.classList.remove("hide"),currentTimeIndicatorArrow.classList.remove("hide"),currentTimeIndicatorBar.style.transform="scaleX("+pct+")",currentTimeIndicatorArrow.style.left=100*pct+"%")}}function getChannelLimit(context){return registrationServices.validateFeature("livetv").then(function(){var limit=browser.slow?100:500;return context.querySelector(".guideRequiresUnlock").classList.add("hide"),limit},function(){var limit=5;return context.querySelector(".guideRequiresUnlock").classList.remove("hide"),context.querySelector(".unlockText").innerHTML=globalize.translate("sharedcomponents#LiveTvGuideRequiresUnlock",limit),limit})}function reloadGuide(context,newStartDate,scrollToTimeMs,focusToTimeMs,focusProgramOnRender){var apiClient=connectionManager.currentApiClient(),channelQuery={StartIndex:0,EnableFavoriteSorting:"false"!==userSettings.get("livetv-favoritechannelsattop")};channelQuery.UserId=apiClient.getCurrentUserId(),getChannelLimit(context).then(function(channelLimit){currentChannelLimit=channelLimit,showLoading(),channelQuery.StartIndex=currentStartIndex,channelQuery.Limit=channelLimit,channelQuery.AddCurrentProgram=!1,channelQuery.EnableUserData=!1,channelQuery.EnableImageTypes="Primary";var categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1;displayMovieContent&&displaySportsContent&&displayNewsContent&&displayKidsContent?(channelQuery.IsMovie=null,channelQuery.IsSports=null,channelQuery.IsKids=null,channelQuery.IsNews=null,channelQuery.IsSeries=null):(displayNewsContent&&(channelQuery.IsNews=!0),displaySportsContent&&(channelQuery.IsSports=!0),displayKidsContent&&(channelQuery.IsKids=!0),displayMovieContent&&(channelQuery.IsMovie=!0),displaySeriesContent&&(channelQuery.IsSeries=!0)),"DatePlayed"===userSettings.get("livetv-channelorder")?(channelQuery.SortBy="DatePlayed",channelQuery.SortOrder="Descending"):(channelQuery.SortBy=null,channelQuery.SortOrder=null);var date=newStartDate;date=new Date(date.getTime()+1e3);var nextDay=new Date(date.getTime()+msPerDay-2e3);console.log(nextDay),apiClient.getLiveTvChannels(channelQuery).then(function(channelsResult){var btnPreviousPage=context.querySelector(".btnPreviousPage"),btnNextPage=context.querySelector(".btnNextPage");channelsResult.TotalRecordCount>channelLimit?(context.querySelector(".guideOptions").classList.remove("hide"),btnPreviousPage.classList.remove("hide"),btnNextPage.classList.remove("hide"),channelQuery.StartIndex?context.querySelector(".btnPreviousPage").disabled=!1:context.querySelector(".btnPreviousPage").disabled=!0,channelQuery.StartIndex+channelLimit",startDate.setTime(startDate.getTime()+cellDurationMs);return html+='
',html+="
",html+='
',html+='arrow_drop_down',html+="
"}function parseDates(program){if(!program.StartDateLocal)try{program.StartDateLocal=datetime.parseISO8601Date(program.StartDate,{toLocal:!0})}catch(err){}if(!program.EndDateLocal)try{program.EndDateLocal=datetime.parseISO8601Date(program.EndDate,{toLocal:!0})}catch(err){}return null}function getTimerIndicator(item){var status;if("SeriesTimer"===item.Type)return'';if(item.TimerId||item.SeriesTimerId)status=item.Status||"Cancelled";else{if("Timer"!==item.Type)return"";status=item.Status}return item.SeriesTimerId?"Cancelled"!==status?'':'':''}function getChannelProgramsHtml(context,date,channel,programs,options,listInfo){var html="",startMs=date.getTime(),endMs=startMs+msPerDay-1,outerCssClass=layoutManager.tv?"channelPrograms channelPrograms-tv":"channelPrograms";html+='
';for(var programsFound,clickAction=layoutManager.tv?"link":"programdialog",categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1,enableColorCodedBackgrounds="true"===userSettings.get("guide-colorcodedbackgrounds"),i=listInfo.startIndex,length=programs.length;iendMs)break;items[program.Id]=program;var renderStartMs=Math.max(program.StartDateLocal.getTime(),startMs),startPercent=(program.StartDateLocal.getTime()-startMs)/msPerDay;startPercent*=100,startPercent=Math.max(startPercent,0);var renderEndMs=Math.min(program.EndDateLocal.getTime(),endMs),endPercent=(renderEndMs-renderStartMs)/msPerDay;endPercent*=100;var cssClass="programCell clearButton itemAction",accentCssClass=null,displayInnerContent=!0;program.IsKids?(cssClass+=" childProgramInfo",displayInnerContent=displayKidsContent,accentCssClass="childAccent"):program.IsSports?(cssClass+=" sportsProgramInfo",displayInnerContent=displaySportsContent,accentCssClass="sportsAccent"):program.IsNews?(cssClass+=" newsProgramInfo",displayInnerContent=displayNewsContent,accentCssClass="newsAccent"):program.IsMovie?(cssClass+=" movieProgramInfo",displayInnerContent=displayMovieContent,accentCssClass="movieAccent"):program.IsSeries?(cssClass+=" plainProgramInfo",displayInnerContent=displaySeriesContent):(cssClass+=" plainProgramInfo",displayInnerContent=displayMovieContent&&displayNewsContent&&displaySportsContent&&displayKidsContent&&displaySeriesContent);var timerAttributes="";program.TimerId&&(timerAttributes+=' data-timerid="'+program.TimerId+'"'),program.SeriesTimerId&&(timerAttributes+=' data-seriestimerid="'+program.SeriesTimerId+'"');var isAttribute=endPercent>=2?' is="emby-programcell"':"";if(html+="',html+=displayInnerContent&&enableColorCodedBackgrounds&&accentCssClass?'
':'
',displayInnerContent){var guideProgramNameClass="guideProgramName";html+='
',html+='
',html+='
'+program.Name;var indicatorHtml=null;program.IsLive&&options.showLiveIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Live")+"":program.IsPremiere&&options.showPremiereIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Premiere")+"":program.IsSeries&&!program.IsRepeat&&options.showNewIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#AttributeNew")+"":program.IsSeries&&program.IsRepeat&&options.showRepeatIndicator&&(indicatorHtml=''+globalize.translate("sharedcomponents#Repeat")+""),(indicatorHtml||program.EpisodeTitle&&options.showEpisodeTitle)&&(html+='
',html+=indicatorHtml||"",program.EpisodeTitle&&options.showEpisodeTitle&&(html+=''+program.EpisodeTitle+""),html+="
"),html+="
",program.IsHD&&options.showHdIcon&&(html+=layoutManager.tv?'
HD
':'
HD
'),html+=getTimerIndicator(program),html+="
"}html+="
",html+=""}}else if(programsFound)break}return html+="
"}function renderChannelHeaders(context,channels,apiClient){for(var html="",i=0,length=channels.length;i',channel.Number&&(html+='

'+channel.Number+"

"),!hasChannelImage&&channel.Name&&(html+='
'+channel.Name+"
"),html+=""}var channelList=context.querySelector(".channelsContainer");channelList.innerHTML=html,imageLoader.lazyChildren(channelList)}function renderPrograms(context,date,channels,programs){for(var allowIndicators=dom.getWindowSize().innerWidth>=600,options={showHdIcon:allowIndicators&&"true"===userSettings.get("guide-indicator-hd"),showLiveIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-live"),showPremiereIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-premiere"),showNewIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-new"),showRepeatIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-repeat"),showEpisodeTitle:!layoutManager.tv},listInfo={startIndex:0},html=[],i=0,length=channels.length;i=pct||left+width>=pct)break;programCell=programCell.nextSibling}programCell?focusManager.focus(programCell):focusManager.autoFocus(autoFocusParent,!0)}}function nativeScrollTo(container,pos,horizontal){container.scrollTo?horizontal?container.scrollTo(pos,0):container.scrollTo(0,pos):horizontal?container.scrollLeft=Math.round(pos):container.scrollTop=Math.round(pos)}function onProgramGridScroll(context,elem,timeslotHeaders){(new Date).getTime()-lastHeaderScroll>=1e3&&(lastGridScroll=(new Date).getTime(),nativeScrollTo(timeslotHeaders,elem.scrollLeft,!0)),updateProgramCellsOnScroll(elem,programCells)}function onTimeslotHeadersScroll(context,elem){(new Date).getTime()-lastGridScroll>=1e3&&(lastHeaderScroll=(new Date).getTime(),nativeScrollTo(programGrid,elem.scrollLeft,!0))}function changeDate(page,date,scrollToTimeMs,focusToTimeMs,focusProgramOnRender){clearCurrentTimeUpdateInterval();var newStartDate=normalizeDateToTimeslot(date);currentDate=newStartDate,reloadGuide(page,newStartDate,scrollToTimeMs,focusToTimeMs,focusProgramOnRender)}function getDateTabText(date,isActive,tabIndex){var cssClass=isActive?"emby-tab-button guide-date-tab-button emby-tab-button-active":"emby-tab-button guide-date-tab-button",html='"}function setDateRange(page,guideInfo){var today=new Date;today.setHours(today.getHours(),0,0,0);var start=datetime.parseISO8601Date(guideInfo.StartDate,{toLocal:!0}),end=datetime.parseISO8601Date(guideInfo.EndDate,{toLocal:!0});start.setHours(0,0,0,0),end.setHours(0,0,0,0),start.getTime()>=end.getTime()&&end.setDate(start.getDate()+1),start=new Date(Math.max(today,start));var dateTabsHtml="",tabIndex=0,date=new Date;for(currentDate&&date.setTime(currentDate.getTime()),date.setHours(0,0,0,0),start.setHours(0,0,0,0);start<=end;){var isActive=date.getDate()===start.getDate()&&date.getMonth()===start.getMonth()&&date.getFullYear()===start.getFullYear();dateTabsHtml+=getDateTabText(start,isActive,tabIndex),start.setDate(start.getDate()+1),start.setHours(0,0,0,0),tabIndex++}page.querySelector(".emby-tabs-slider").innerHTML=dateTabsHtml,page.querySelector(".guideDateTabs").refresh();var newDate=new Date,newDateHours=newDate.getHours(),scrollToTimeMs=60*newDateHours*60*1e3,minutes=newDate.getMinutes();minutes>=30&&(scrollToTimeMs+=18e5);var focusToTimeMs=60*(60*newDateHours+minutes)*1e3;changeDate(page,date,scrollToTimeMs,focusToTimeMs,layoutManager.tv)}function reloadPage(page){showLoading();var apiClient=connectionManager.currentApiClient();apiClient.getLiveTvGuideInfo().then(function(guideInfo){setDateRange(page,guideInfo)})}function getChildren(element){var nativeResult=element.children;if(nativeResult)return nativeResult;for(var node,i=0,nodes=element.childNodes,children=[];null!=(node=nodes[i++]);)1===node.nodeType&&children.push(node);return children}function isFirstChild(element){var children=getChildren(element.parentNode);return element===children[0]}function isLastChild(element){var children=getChildren(element.parentNode);return children.length>0&&element===children[children.length-1]}function onInputCommand(e){var container,target=e.target,programCell=dom.parentWithClass(target,"programCell"),scrollX=!1;switch(e.detail.command){case"up":container=programCell?programGrid:null,container&&isFirstChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveUp(target,{container:container});break;case"down":container=programCell?programGrid:null,container&&isLastChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveDown(target,{container:container});break;case"left":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,container&&isFirstChild(programCell)&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveLeft(target,{container:container}),scrollX=!0;break;case"right":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,lastFocusDirection=e.detail.command,focusManager.moveRight(target,{container:container}),scrollX=!0;break;default:return}e.preventDefault(),e.stopPropagation()}function onScrollerFocus(e){var target=e.target,programCell=dom.parentWithClass(target,"programCell");if(programCell){var focused=target,id=focused.getAttribute("data-id"),item=items[id];item&&events.trigger(self,"focus",[{item:item}])}if("left"===lastFocusDirection||"right"===lastFocusDirection)programCell&&scrollHelper.toCenter(programGrid,programCell,!0);else if("up"===lastFocusDirection||"down"===lastFocusDirection){var verticalScroller=dom.parentWithClass(target,"guideVerticalScroller");if(verticalScroller){var focusedElement=programCell||dom.parentWithTag(target,"BUTTON");verticalScroller.toCenter(focusedElement,!0)}}}function setScrollEvents(view,enabled){if(layoutManager.tv){var guideVerticalScroller=view.querySelector(".guideVerticalScroller");enabled?inputManager.on(guideVerticalScroller,onInputCommand):inputManager.off(guideVerticalScroller,onInputCommand)}}function onTimerCreated(e,apiClient,data){for(var programId=data.ProgramId,newTimerId=data.Id,cells=options.element.querySelectorAll('.programCell[data-id="'+programId+'"]'),i=0,length=cells.length;i'),newTimerId&&cell.setAttribute("data-timerid",newTimerId)}}function onSeriesTimerCreated(e,apiClient,data){}function onTimerCancelled(e,apiClient,data){for(var id=data.Id,cells=options.element.querySelectorAll('.programCell[data-timerid="'+id+'"]'),i=0,length=cells.length;i0&&pctOfWidth<=100?(guideProgramName.style.transform="translateX("+pctOfWidth+"%)",caret.classList.remove("hide")):(guideProgramName.style.transform="none",caret.classList.add("hide")))}function updateProgramCellsOnScroll(programGrid,programCells){isUpdatingProgramCellScroll||(isUpdatingProgramCellScroll=!0,requestAnimationFrame(function(){for(var scrollLeft=programGrid.scrollLeft,scrollPct=scrollLeft?scrollLeft/programGrid.scrollWidth*100:0,i=0,length=programCells.length;i=0?date.setHours(date.getHours(),cellCurationMinutes,0,0):date.setHours(date.getHours(),0,0,0),date}function showLoading(){loading.show()}function hideLoading(){loading.hide()}function startCurrentTimeUpdateInterval(){clearCurrentTimeUpdateInterval(),currentTimeUpdateInterval=setInterval(updateCurrentTimeIndicator,6e4),updateCurrentTimeIndicator()}function clearCurrentTimeUpdateInterval(){var interval=currentTimeUpdateInterval;interval&&clearInterval(interval),currentTimeUpdateInterval=null,currentTimeIndicatorBar=null,currentTimeIndicatorArrow=null}function updateCurrentTimeIndicator(){if(currentTimeIndicatorBar||(currentTimeIndicatorBar=options.element.querySelector(".currentTimeIndicatorBar")),currentTimeIndicatorArrow||(currentTimeIndicatorArrow=options.element.querySelector(".currentTimeIndicatorArrowContainer")),currentDate){var dateDifference=(new Date).getTime()-currentDate.getTime(),pct=dateDifference>0?dateDifference/totalRendererdMs:0;pct=Math.min(pct,1),pct<=0||pct>=1?(currentTimeIndicatorBar.classList.add("hide"),currentTimeIndicatorArrow.classList.add("hide")):(currentTimeIndicatorBar.classList.remove("hide"),currentTimeIndicatorArrow.classList.remove("hide"),currentTimeIndicatorBar.style.transform="scaleX("+pct+")",currentTimeIndicatorArrow.style.left=100*pct+"%")}}function getChannelLimit(context){return registrationServices.validateFeature("livetv").then(function(){var limit=browser.slow?100:500;return context.querySelector(".guideRequiresUnlock").classList.add("hide"),limit},function(){var limit=5;return context.querySelector(".guideRequiresUnlock").classList.remove("hide"),context.querySelector(".unlockText").innerHTML=globalize.translate("sharedcomponents#LiveTvGuideRequiresUnlock",limit),limit})}function reloadGuide(context,newStartDate,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender){var apiClient=connectionManager.currentApiClient(),channelQuery={StartIndex:0,EnableFavoriteSorting:"false"!==userSettings.get("livetv-favoritechannelsattop")};channelQuery.UserId=apiClient.getCurrentUserId(),getChannelLimit(context).then(function(channelLimit){currentChannelLimit=channelLimit,showLoading(),channelQuery.StartIndex=currentStartIndex,channelQuery.Limit=channelLimit,channelQuery.AddCurrentProgram=!1,channelQuery.EnableUserData=!1,channelQuery.EnableImageTypes="Primary";var categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1;displayMovieContent&&displaySportsContent&&displayNewsContent&&displayKidsContent?(channelQuery.IsMovie=null,channelQuery.IsSports=null,channelQuery.IsKids=null,channelQuery.IsNews=null,channelQuery.IsSeries=null):(displayNewsContent&&(channelQuery.IsNews=!0),displaySportsContent&&(channelQuery.IsSports=!0),displayKidsContent&&(channelQuery.IsKids=!0),displayMovieContent&&(channelQuery.IsMovie=!0),displaySeriesContent&&(channelQuery.IsSeries=!0)),"DatePlayed"===userSettings.get("livetv-channelorder")?(channelQuery.SortBy="DatePlayed",channelQuery.SortOrder="Descending"):(channelQuery.SortBy=null,channelQuery.SortOrder=null);var date=newStartDate;date=new Date(date.getTime()+1e3);var nextDay=new Date(date.getTime()+msPerDay-2e3);apiClient.getLiveTvChannels(channelQuery).then(function(channelsResult){var btnPreviousPage=context.querySelector(".btnPreviousPage"),btnNextPage=context.querySelector(".btnNextPage");channelsResult.TotalRecordCount>channelLimit?(context.querySelector(".guideOptions").classList.remove("hide"),btnPreviousPage.classList.remove("hide"),btnNextPage.classList.remove("hide"),channelQuery.StartIndex?context.querySelector(".btnPreviousPage").disabled=!1:context.querySelector(".btnPreviousPage").disabled=!0,channelQuery.StartIndex+channelLimit",startDate.setTime(startDate.getTime()+cellDurationMs);return html+='
',html+="
",html+='
',html+='arrow_drop_down',html+="
"}function parseDates(program){if(!program.StartDateLocal)try{program.StartDateLocal=datetime.parseISO8601Date(program.StartDate,{toLocal:!0})}catch(err){}if(!program.EndDateLocal)try{program.EndDateLocal=datetime.parseISO8601Date(program.EndDate,{toLocal:!0})}catch(err){}return null}function getTimerIndicator(item){var status;if("SeriesTimer"===item.Type)return'';if(item.TimerId||item.SeriesTimerId)status=item.Status||"Cancelled";else{if("Timer"!==item.Type)return"";status=item.Status}return item.SeriesTimerId?"Cancelled"!==status?'':'':''}function getChannelProgramsHtml(context,date,channel,programs,options,listInfo){var html="",startMs=date.getTime(),endMs=startMs+msPerDay-1,outerCssClass=layoutManager.tv?"channelPrograms channelPrograms-tv":"channelPrograms";html+='
';for(var programsFound,clickAction=layoutManager.tv?"link":"programdialog",categories=self.categoryOptions.categories||[],displayMovieContent=!categories.length||categories.indexOf("movies")!==-1,displaySportsContent=!categories.length||categories.indexOf("sports")!==-1,displayNewsContent=!categories.length||categories.indexOf("news")!==-1,displayKidsContent=!categories.length||categories.indexOf("kids")!==-1,displaySeriesContent=!categories.length||categories.indexOf("series")!==-1,enableColorCodedBackgrounds="true"===userSettings.get("guide-colorcodedbackgrounds"),i=listInfo.startIndex,length=programs.length;iendMs)break;items[program.Id]=program;var renderStartMs=Math.max(program.StartDateLocal.getTime(),startMs),startPercent=(program.StartDateLocal.getTime()-startMs)/msPerDay;startPercent*=100,startPercent=Math.max(startPercent,0);var renderEndMs=Math.min(program.EndDateLocal.getTime(),endMs),endPercent=(renderEndMs-renderStartMs)/msPerDay;endPercent*=100;var cssClass="programCell clearButton itemAction",accentCssClass=null,displayInnerContent=!0;program.IsKids?(cssClass+=" childProgramInfo",displayInnerContent=displayKidsContent,accentCssClass="childAccent"):program.IsSports?(cssClass+=" sportsProgramInfo",displayInnerContent=displaySportsContent,accentCssClass="sportsAccent"):program.IsNews?(cssClass+=" newsProgramInfo",displayInnerContent=displayNewsContent,accentCssClass="newsAccent"):program.IsMovie?(cssClass+=" movieProgramInfo",displayInnerContent=displayMovieContent,accentCssClass="movieAccent"):program.IsSeries?(cssClass+=" plainProgramInfo",displayInnerContent=displaySeriesContent):(cssClass+=" plainProgramInfo",displayInnerContent=displayMovieContent&&displayNewsContent&&displaySportsContent&&displayKidsContent&&displaySeriesContent);var timerAttributes="";program.TimerId&&(timerAttributes+=' data-timerid="'+program.TimerId+'"'),program.SeriesTimerId&&(timerAttributes+=' data-seriestimerid="'+program.SeriesTimerId+'"');var isAttribute=endPercent>=2?' is="emby-programcell"':"";if(html+="',html+=displayInnerContent&&enableColorCodedBackgrounds&&accentCssClass?'
':'
',displayInnerContent){var guideProgramNameClass="guideProgramName";html+='
',html+='
',html+='
'+program.Name;var indicatorHtml=null;program.IsLive&&options.showLiveIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Live")+"":program.IsPremiere&&options.showPremiereIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#Premiere")+"":program.IsSeries&&!program.IsRepeat&&options.showNewIndicator?indicatorHtml=''+globalize.translate("sharedcomponents#AttributeNew")+"":program.IsSeries&&program.IsRepeat&&options.showRepeatIndicator&&(indicatorHtml=''+globalize.translate("sharedcomponents#Repeat")+""),(indicatorHtml||program.EpisodeTitle&&options.showEpisodeTitle)&&(html+='
',html+=indicatorHtml||"",program.EpisodeTitle&&options.showEpisodeTitle&&(html+=''+program.EpisodeTitle+""),html+="
"),html+="
",program.IsHD&&options.showHdIcon&&(html+=layoutManager.tv?'
HD
':'
HD
'),html+=getTimerIndicator(program),html+="
"}html+="
",html+=""}}else if(programsFound)break}return html+="
"}function renderChannelHeaders(context,channels,apiClient){for(var html="",i=0,length=channels.length;i',channel.Number&&(html+='

'+channel.Number+"

"),!hasChannelImage&&channel.Name&&(html+='
'+channel.Name+"
"),html+=""}var channelList=context.querySelector(".channelsContainer");channelList.innerHTML=html,imageLoader.lazyChildren(channelList)}function renderPrograms(context,date,channels,programs){for(var allowIndicators=dom.getWindowSize().innerWidth>=600,options={showHdIcon:allowIndicators&&"true"===userSettings.get("guide-indicator-hd"),showLiveIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-live"),showPremiereIndicator:allowIndicators&&"false"!==userSettings.get("guide-indicator-premiere"),showNewIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-new"),showRepeatIndicator:allowIndicators&&"true"===userSettings.get("guide-indicator-repeat"),showEpisodeTitle:!layoutManager.tv},listInfo={startIndex:0},html=[],i=0,length=channels.length;i=pct||left+width>=pct)break;programCell=programCell.nextSibling}programCell?focusManager.focus(programCell):focusManager.autoFocus(autoFocusParent,!0)}}function nativeScrollTo(container,pos,horizontal){container.scrollTo?horizontal?container.scrollTo(pos,0):container.scrollTo(0,pos):horizontal?container.scrollLeft=Math.round(pos):container.scrollTop=Math.round(pos)}function onProgramGridScroll(context,elem,timeslotHeaders){(new Date).getTime()-lastHeaderScroll>=1e3&&(lastGridScroll=(new Date).getTime(),nativeScrollTo(timeslotHeaders,elem.scrollLeft,!0)),updateProgramCellsOnScroll(elem,programCells)}function onTimeslotHeadersScroll(context,elem){(new Date).getTime()-lastGridScroll>=1e3&&(lastHeaderScroll=(new Date).getTime(),nativeScrollTo(programGrid,elem.scrollLeft,!0))}function changeDate(page,date,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender){clearCurrentTimeUpdateInterval();var newStartDate=normalizeDateToTimeslot(date);currentDate=newStartDate,reloadGuide(page,newStartDate,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,focusProgramOnRender)}function getDateTabText(date,isActive,tabIndex){var cssClass=isActive?"emby-tab-button guide-date-tab-button emby-tab-button-active":"emby-tab-button guide-date-tab-button",html='"}function setDateRange(page,guideInfo){var today=new Date,nowHours=today.getHours();today.setHours(nowHours,0,0,0);var start=datetime.parseISO8601Date(guideInfo.StartDate,{toLocal:!0}),end=datetime.parseISO8601Date(guideInfo.EndDate,{toLocal:!0});start.setHours(nowHours,0,0,0),end.setHours(0,0,0,0),start.getTime()>=end.getTime()&&end.setDate(start.getDate()+1),start=new Date(Math.max(today,start));var dateTabsHtml="",tabIndex=0,date=new Date;currentDate&&date.setTime(currentDate.getTime()),date.setHours(nowHours,0,0,0);var startTimeOfDayMs=60*start.getHours()*60*1e3;for(startTimeOfDayMs+=60*start.getMinutes()*1e3;start<=end;){var isActive=date.getDate()===start.getDate()&&date.getMonth()===start.getMonth()&&date.getFullYear()===start.getFullYear();dateTabsHtml+=getDateTabText(start,isActive,tabIndex),start.setDate(start.getDate()+1),start.setHours(0,0,0,0),tabIndex++}page.querySelector(".emby-tabs-slider").innerHTML=dateTabsHtml,page.querySelector(".guideDateTabs").refresh();var newDate=new Date,newDateHours=newDate.getHours(),scrollToTimeMs=60*newDateHours*60*1e3,minutes=newDate.getMinutes();minutes>=30&&(scrollToTimeMs+=18e5);var focusToTimeMs=60*(60*newDateHours+minutes)*1e3;changeDate(page,date,scrollToTimeMs,focusToTimeMs,startTimeOfDayMs,layoutManager.tv)}function reloadPage(page){showLoading();var apiClient=connectionManager.currentApiClient();apiClient.getLiveTvGuideInfo().then(function(guideInfo){setDateRange(page,guideInfo)})}function getChildren(element){var nativeResult=element.children;if(nativeResult)return nativeResult;for(var node,i=0,nodes=element.childNodes,children=[];null!=(node=nodes[i++]);)1===node.nodeType&&children.push(node);return children}function isFirstChild(element){var children=getChildren(element.parentNode);return element===children[0]}function isLastChild(element){var children=getChildren(element.parentNode);return children.length>0&&element===children[children.length-1]}function onInputCommand(e){var container,target=e.target,programCell=dom.parentWithClass(target,"programCell"),scrollX=!1;switch(e.detail.command){case"up":container=programCell?programGrid:null,container&&isFirstChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveUp(target,{container:container});break;case"down":container=programCell?programGrid:null,container&&isLastChild(dom.parentWithClass(programCell,"channelPrograms"))&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveDown(target,{container:container});break;case"left":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,container&&isFirstChild(programCell)&&(container=null),lastFocusDirection=e.detail.command,focusManager.moveLeft(target,{container:container}),scrollX=!0;break;case"right":container=programCell?dom.parentWithClass(programCell,"channelPrograms"):null,lastFocusDirection=e.detail.command,focusManager.moveRight(target,{container:container}),scrollX=!0;break;default:return}e.preventDefault(),e.stopPropagation()}function onScrollerFocus(e){var target=e.target,programCell=dom.parentWithClass(target,"programCell");if(programCell){var focused=target,id=focused.getAttribute("data-id"),item=items[id];item&&events.trigger(self,"focus",[{item:item}])}if("left"===lastFocusDirection||"right"===lastFocusDirection)programCell&&scrollHelper.toCenter(programGrid,programCell,!0);else if("up"===lastFocusDirection||"down"===lastFocusDirection){var verticalScroller=dom.parentWithClass(target,"guideVerticalScroller");if(verticalScroller){var focusedElement=programCell||dom.parentWithTag(target,"BUTTON");verticalScroller.toCenter(focusedElement,!0)}}}function setScrollEvents(view,enabled){if(layoutManager.tv){var guideVerticalScroller=view.querySelector(".guideVerticalScroller");enabled?inputManager.on(guideVerticalScroller,onInputCommand):inputManager.off(guideVerticalScroller,onInputCommand)}}function onTimerCreated(e,apiClient,data){for(var programId=data.ProgramId,newTimerId=data.Id,cells=options.element.querySelectorAll('.programCell[data-id="'+programId+'"]'),i=0,length=cells.length;i'),newTimerId&&cell.setAttribute("data-timerid",newTimerId)}}function onSeriesTimerCreated(e,apiClient,data){}function onTimerCancelled(e,apiClient,data){for(var id=data.Id,cells=options.element.querySelectorAll('.programCell[data-timerid="'+id+'"]'),i=0,length=cells.length;i=interceptors.length)return void resolve();var interceptor=interceptors[index];interceptor.intercept(options).then(function(){runNextPrePlay(interceptors,index+1,options,resolve,reject)},reject)}function playAfterBitrateDetect(connectionManager,maxBitrate,item,playOptions,onPlaybackStartedFn){var promise,startPosition=playOptions.startPositionTicks,player=getPlayer(item,playOptions),activePlayer=self._currentPlayer;return activePlayer?(playNextAfterEnded=!1,promise=onPlaybackChanging(activePlayer,player,item)):promise=Promise.resolve(),isServerItem(item)&&"Game"!==item.MediaType?Promise.all([promise,player.getDeviceProfile(item)]).then(function(responses){var deviceProfile=responses[1],apiClient=connectionManager.getApiClient(item.ServerId);return getPlaybackMediaSource(player,apiClient,deviceProfile,maxBitrate,item,startPosition).then(function(mediaSource){return createStreamInfo(apiClient,item.MediaType,item,mediaSource,startPosition).then(function(streamInfo){return streamInfo.fullscreen=playOptions.fullscreen,getPlayerData(player).isChangingStream=!1,getPlayerData(player).maxStreamingBitrate=maxBitrate,player.play(streamInfo).then(function(){loading.hide(),onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo,mediaSource)},function(){onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo,mediaSource),setTimeout(function(err){onPlaybackError.call(player,err,{type:"mediadecodeerror"})},100)})})})}):promise.then(function(){var streamInfo=createStreamInfoFromUrlItem(item);return streamInfo.fullscreen=playOptions.fullscreen,getPlayerData(player).isChangingStream=!1,player.play(streamInfo).then(function(){loading.hide(),onPlaybackStartedFn(),onPlaybackStarted(player,playOptions,streamInfo)},function(){self.stop(player)})})}function createStreamInfoFromUrlItem(item){return{url:item.Url||item.Path,playMethod:"DirectPlay",item:item,textTracks:[],mediaType:item.MediaType}}function backdropImageUrl(apiClient,item,options){return options=options||{},options.type=options.type||"Backdrop",options.maxWidth||options.width||options.maxHeight||options.height||(options.quality=100),item.BackdropImageTags&&item.BackdropImageTags.length?(options.tag=item.BackdropImageTags[0],apiClient.getScaledImageUrl(item.Id,options)):item.ParentBackdropImageTags&&item.ParentBackdropImageTags.length?(options.tag=item.ParentBackdropImageTags[0],apiClient.getScaledImageUrl(item.ParentBackdropItemId,options)):null}function getMimeType(type,container){if(container=(container||"").toLowerCase(),"audio"===type){if("opus"===container)return"audio/ogg";if("webma"===container)return"audio/webm";if("m4a"===container)return"audio/mp4"}else if("video"===type){if("mkv"===container)return"video/x-matroska";if("m4v"===container)return"video/mp4";if("mov"===container)return"video/quicktime";if("mpg"===container)return"video/mpeg";if("flv"===container)return"video/x-flv"}return type+"/"+container}function createStreamInfo(apiClient,type,item,mediaSource,startPosition,forceTranscoding){var mediaUrl,contentType,directOptions,transcodingOffsetTicks=0,playerStartPositionTicks=startPosition,liveStreamId=mediaSource.LiveStreamId,playMethod="Transcode",mediaSourceContainer=(mediaSource.Container||"").toLowerCase();if("Video"===type)contentType=getMimeType("video",mediaSourceContainer),mediaSource.enableDirectPlay&&!forceTranscoding?(mediaUrl=mediaSource.Path,playMethod="DirectPlay"):mediaSource.SupportsDirectStream&&!forceTranscoding?(directOptions={Static:!0,mediaSourceId:mediaSource.Id,deviceId:apiClient.deviceId(),api_key:apiClient.accessToken()},mediaSource.ETag&&(directOptions.Tag=mediaSource.ETag),mediaSource.LiveStreamId&&(directOptions.LiveStreamId=mediaSource.LiveStreamId),mediaUrl=apiClient.getUrl("Videos/"+item.Id+"/stream."+mediaSourceContainer,directOptions),playMethod="DirectStream"):mediaSource.SupportsTranscoding&&(mediaUrl=apiClient.getUrl(mediaSource.TranscodingUrl),"hls"===mediaSource.TranscodingSubProtocol?contentType="application/x-mpegURL":(playerStartPositionTicks=null,contentType=getMimeType("video",mediaSource.TranscodingContainer),mediaUrl.toLowerCase().indexOf("copytimestamps=true")===-1&&(transcodingOffsetTicks=startPosition||0)));else if("Audio"===type)if(contentType=getMimeType("audio",mediaSourceContainer),mediaSource.enableDirectPlay&&!forceTranscoding)mediaUrl=mediaSource.Path,playMethod="DirectPlay";else{var isDirectStream=mediaSource.SupportsDirectStream;isDirectStream&&!forceTranscoding?(directOptions={Static:!0,mediaSourceId:mediaSource.Id,deviceId:apiClient.deviceId(),api_key:apiClient.accessToken()},mediaSource.ETag&&(directOptions.Tag=mediaSource.ETag),mediaSource.LiveStreamId&&(directOptions.LiveStreamId=mediaSource.LiveStreamId),mediaUrl=apiClient.getUrl("Audio/"+item.Id+"/stream."+mediaSourceContainer,directOptions),playMethod="DirectStream"):mediaSource.SupportsTranscoding&&(mediaUrl=apiClient.getUrl(mediaSource.TranscodingUrl),"hls"===mediaSource.TranscodingSubProtocol?contentType="application/x-mpegURL":(transcodingOffsetTicks=startPosition||0,playerStartPositionTicks=null,contentType=getMimeType("audio",mediaSource.TranscodingContainer)))}else"Game"===type&&(mediaUrl=mediaSource.Path,playMethod="DirectPlay");!mediaUrl&&mediaSource.SupportsDirectPlay&&(mediaUrl=mediaSource.Path,playMethod="DirectPlay");var resultInfo={url:mediaUrl,mimeType:contentType,transcodingOffsetTicks:transcodingOffsetTicks,playMethod:playMethod,playerStartPositionTicks:playerStartPositionTicks,item:item,mediaSource:mediaSource,textTracks:getTextTracks(apiClient,mediaSource),tracks:getTextTracks(apiClient,mediaSource),mediaType:type,liveStreamId:liveStreamId,playSessionId:getParam("playSessionId",mediaUrl),title:item.Name},backdropUrl=backdropImageUrl(apiClient,item,{});return backdropUrl&&(resultInfo.backdropUrl=backdropUrl),Promise.resolve(resultInfo)}function getParam(name,url){name=name.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+name+"=([^&#]*)",regex=new RegExp(regexS,"i"),results=regex.exec(url);return null==results?"":decodeURIComponent(results[1].replace(/\+/g," "))}function getTextTracks(apiClient,mediaSource){for(var subtitleStreams=mediaSource.MediaStreams.filter(function(s){return"Subtitle"===s.Type}),textStreams=subtitleStreams.filter(function(s){return"External"===s.DeliveryMethod}),tracks=[],i=0,length=textStreams.length;i=playlistLength&&(newIndex=0);break;default:newIndex=self.getCurrentPlaylistIndex(player)+1}if(newIndex<0||newIndex>=playlistLength)return null;var item=playlist[newIndex];return item?{item:item,index:newIndex}:null}function queue(options,mode,player){if(player=player||self._currentPlayer,!player)return self.play(options);if(!enableLocalPlaylistManagement(player))return"next"===mode?player.queueNext(item):player.queue(item);if(options.items)return translateItemsForPlayback(options.items,options).then(function(items){queueAll(items,mode)});if(!options.serverId)throw new Error("serverId required!");return getItemsForPlayback(options.serverId,{Ids:options.ids.join(",")}).then(function(result){return translateItemsForPlayback(result.Items,options).then(function(items){queueAll(items,mode)})})}function queueAll(items,mode){for(var i=0,length=items.length;idatetime.parseISO8601Date(item.EndDate).getTime()||(new Date).getTime()=supported.length&&(index=0),self.setAspectRatio(supported[index].id,player)}},self.setAspectRatio=function(val,player){player=player||self._currentPlayer,player&&player.setAspectRatio&&player.setAspectRatio(val)},self.getSupportedAspectRatios=function(player){return player=player||self._currentPlayer,player&&player.getSupportedAspectRatios?player.getSupportedAspectRatios():[]},self.getAspectRatio=function(player){if(player=player||self._currentPlayer,player&&player.getAspectRatio)return player.getAspectRatio()};var brightnessOsdLoaded;self.setBrightness=function(val,player){player=player||self._currentPlayer,player&&(brightnessOsdLoaded||(brightnessOsdLoaded=!0,require(["brightnessOsd"])),player.setBrightness(val))},self.getBrightness=function(player){if(player=player||self._currentPlayer)return player.getBrightness()},self.setVolume=function(val,player){player=player||self._currentPlayer,player&&player.setVolume(val)},self.getVolume=function(player){if(player=player||self._currentPlayer)return player.getVolume()},self.volumeUp=function(player){player=player||self._currentPlayer,player&&player.volumeUp()},self.volumeDown=function(player){player=player||self._currentPlayer,player&&player.volumeDown()},self.changeAudioStreamIndex=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.changeAudioStreamIndex()},self.changeSubtitleStreamIndex=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.changeSubtitleStreamIndex()},self.getAudioStreamIndex=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getAudioStreamIndex():getPlayerData(player).audioStreamIndex},self.setAudioStreamIndex=function(index,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.setAudioStreamIndex(index):void("Transcode"!==getPlayerData(player).streamInfo.playMethod&&player.canSetAudioStreamIndex()?(player.setAudioStreamIndex(index),getPlayerData(player).audioStreamIndex=index):(changeStream(player,getCurrentTicks(player),{AudioStreamIndex:index}),getPlayerData(player).audioStreamIndex=index))},self.getMaxStreamingBitrate=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getMaxStreamingBitrate():getPlayerData(player).maxStreamingBitrate||appSettings.maxStreamingBitrate()},self.enableAutomaticBitrateDetection=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.enableAutomaticBitrateDetection():appSettings.enableAutomaticBitrateDetection()},self.setMaxStreamingBitrate=function(options,player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.setMaxStreamingBitrate(options);var promise;options.enableAutomaticBitrateDetection?(appSettings.enableAutomaticBitrateDetection(!0),promise=connectionManager.getApiClient(self.currentItem(player).ServerId).detectBitrate(!0)):(appSettings.enableAutomaticBitrateDetection(!1),promise=Promise.resolve(options.maxBitrate)),promise.then(function(bitrate){appSettings.maxStreamingBitrate(bitrate),changeStream(player,getCurrentTicks(player),{MaxStreamingBitrate:bitrate})})},self.isFullscreen=function(player){return player=player||self._currentPlayer,!player.isLocalPlayer||player.isFullscreen?player.isFullscreen():fullscreenManager.isFullScreen()},self.toggleFullscreen=function(player){return player=player||self._currentPlayer,!player.isLocalPlayer||player.toggleFulscreen?player.toggleFulscreen():void(fullscreenManager.isFullScreen()?fullscreenManager.exitFullscreen():fullscreenManager.requestFullscreen())},self.togglePictureInPicture=function(player){return player=player||self._currentPlayer,player.togglePictureInPicture()},self.getSubtitleStreamIndex=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.getSubtitleStreamIndex();if(!player)throw new Error("player cannot be null");return getPlayerData(player).subtitleStreamIndex},self.setSubtitleStreamIndex=function(index,player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.setSubtitleStreamIndex(index);var currentStream=getCurrentSubtitleStream(player),newStream=getSubtitleStream(player,index);if(currentStream||newStream){var selectedTrackElementIndex=-1,currentPlayMethod=(getPlayerData(player).streamInfo||{}).playMethod;currentStream&&!newStream?("Encode"===currentStream.DeliveryMethod||"Embed"===currentStream.DeliveryMethod&&"Transcode"===currentPlayMethod)&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1}):!currentStream&&newStream?"External"===newStream.DeliveryMethod?selectedTrackElementIndex=index:"Embed"===newStream.DeliveryMethod&&"Transcode"!==currentPlayMethod?selectedTrackElementIndex=index:changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index}):currentStream&&newStream&&("External"===newStream.DeliveryMethod||"Embed"===newStream.DeliveryMethod&&"Transcode"!==currentPlayMethod?(selectedTrackElementIndex=index,"External"!==currentStream.DeliveryMethod&&"Embed"!==currentStream.DeliveryMethod&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1})):changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index})),player.setSubtitleStreamIndex(selectedTrackElementIndex),getPlayerData(player).subtitleStreamIndex=index}},self.toggleDisplayMirroring=function(){self.enableDisplayMirroring(!self.enableDisplayMirroring())},self.enableDisplayMirroring=function(enabled){if(null!=enabled){var val=enabled?"1":"0";return void appSettings.set("displaymirror",val)}return"0"!==(appSettings.get("displaymirror")||"")},self.stop=function(player){return player=player||self._currentPlayer,player?(playNextAfterEnded=!1,player.stop(!0,!0)):Promise.resolve()},self.playPause=function(player){if(player=player||self._currentPlayer)return player.playPause?player.playPause():player.paused()?self.unpause(player):self.pause(player)},self.paused=function(player){if(player=player||self._currentPlayer)return player.paused()},self.pause=function(player){player=player||self._currentPlayer,player&&player.pause()},self.unpause=function(player){player=player||self._currentPlayer,player&&player.unpause()},self.seek=function(ticks,player){return ticks=Math.max(0,ticks),player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.seek(ticks):void changeStream(player,ticks)},self.nextChapter=function(player){player=player||self._currentPlayer;var item=self.currentItem(player),ticks=getCurrentTicks(player),nextChapter=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks>ticks})[0];nextChapter?self.seek(nextChapter.StartPositionTicks,player):self.nextTrack(player)},self.previousChapter=function(player){player=player||self._currentPlayer;var item=self.currentItem(player),ticks=getCurrentTicks(player);ticks-=1e8,0===self.getCurrentPlaylistIndex(player)&&(ticks=Math.max(ticks,0));var previousChapters=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks<=ticks});previousChapters.length?self.seek(previousChapters[previousChapters.length-1].StartPositionTicks,player):self.previousTrack(player)},self.fastForward=function(player){if(player=player||self._currentPlayer,null!=player.fastForward)return void player.fastForward(userSettings.skipForwardLength());var ticks=getCurrentTicks(player);ticks+=1e4*userSettings.skipForwardLength();var runTimeTicks=self.duration(player)||0;ticks0||canPlayerSeek(player)),item&&(state.NowPlayingItem=getNowPlayingItemForReporting(player,item,mediaSource)),state.MediaSource=mediaSource,Promise.resolve(state)},self.currentTime=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.currentTime():getCurrentTicks(player)},self.duration=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.duration();if(!player)throw new Error("player cannot be null");var streamInfo=getPlayerData(player).streamInfo;if(streamInfo&&streamInfo.mediaSource&&streamInfo.mediaSource.RunTimeTicks)return streamInfo.mediaSource.RunTimeTicks;var playerDuration=player.duration();return playerDuration&&(playerDuration*=1e4),playerDuration};var currentId=0;self.getSubtitleUrl=function(textStream,serverId){var apiClient=connectionManager.getApiClient(serverId),textStreamUrl=textStream.IsExternalUrl?textStream.DeliveryUrl:apiClient.getUrl(textStream.DeliveryUrl);return textStreamUrl},self.setCurrentPlaylistItem=function(playlistItemId,player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.setCurrentPlaylistItem(playlistItemId);for(var newItem,newItemIndex,i=0,length=playlist.length;i=playlist.length)throw new Error("newIndex out of bounds");moveInArray(playlist,oldIndex,newIndex),events.trigger(player,"playlistitemmove",[{playlistItemId:playlistItemId,newIndex:newIndex}])}},self.getCurrentPlaylistIndex=function(i,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getCurrentPlaylistIndex():findPlaylistIndex(currentPlaylistItemId,playlist)},self.getCurrentPlaylistItemId=function(i,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getCurrentPlaylistItemId():currentPlaylistItemId},self.setRepeatMode=function(value,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.setRepeatMode(value):(repeatMode=value,void events.trigger(player,"repeatmodechange"))},self.getRepeatMode=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getRepeatMode():repeatMode},self.nextTrack=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.nextTrack();var newItemInfo=getNextItemInfo(player);if(newItemInfo){console.log("playing next track");var playOptions=Object.assign({},currentPlayOptions,{startPositionTicks:0});playInternal(newItemInfo.item,playOptions,function(){setPlaylistState(newItemInfo.item.PlaylistItemId,newItemInfo.index)})}},self.previousTrack=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.previousTrack();var newIndex=self.getCurrentPlaylistIndex(player)-1;if(newIndex>=0){var newItem=playlist[newIndex];if(newItem){var playOptions=Object.assign({},currentPlayOptions,{startPositionTicks:0});playInternal(newItem,playOptions,function(){setPlaylistState(newItem.PlaylistItemId,newIndex)})}}},self.queue=function(options,player){queue(options,"",player)},self.queueNext=function(options,player){queue(options,"next",player)},events.on(pluginManager,"registered",function(e,plugin){"mediaplayer"===plugin.type&&initMediaPlayer(plugin)}),pluginManager.ofType("mediaplayer").map(initMediaPlayer),window.addEventListener("beforeunload",function(e){var player=self._currentPlayer;player&&self.isPlaying(player)&&(playNextAfterEnded=!1,onPlaybackStopped.call(player))}),events.on(serverNotifications,"ServerShuttingDown",function(e,apiClient,data){self.setDefaultPlayerActive()}),events.on(serverNotifications,"ServerRestarting",function(e,apiClient,data){self.setDefaultPlayerActive()})}return PlaybackManager.prototype.trySetActiveDeviceName=function(name){name=normalizeName(name);var instance=this;instance.getTargets().then(function(result){var target=result.filter(function(p){return normalizeName(p.name)===name})[0];target&&instance.trySetActivePlayer(target.playerName,target)})},PlaybackManager.prototype.displayContent=function(options,player){player=player||this._currentPlayer,player&&player.displayContent&&player.displayContent(options)},PlaybackManager.prototype.beginPlayerUpdates=function(player){player.beginPlayerUpdates&&player.beginPlayerUpdates()},PlaybackManager.prototype.endPlayerUpdates=function(player){player.endPlayerUpdates&&player.endPlayerUpdates()},PlaybackManager.prototype.setDefaultPlayerActive=function(){this.setActivePlayer("localplayer")},PlaybackManager.prototype.removeActivePlayer=function(name){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.name===name&&this.setDefaultPlayerActive()},PlaybackManager.prototype.removeActiveTarget=function(id){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.id===id&&this.setDefaultPlayerActive()},PlaybackManager.prototype.disconnectFromPlayer=function(){var playerInfo=this.getPlayerInfo();if(playerInfo){var instance=this;playerInfo.supportedCommands.indexOf("EndSession")!==-1?require(["dialog"],function(dialog){var menuItems=[];menuItems.push({name:globalize.translate("ButtonYes"),id:"yes"}),menuItems.push({name:globalize.translate("ButtonNo"),id:"no"}),dialog({buttons:menuItems,text:globalize.translate("ConfirmEndPlayerSession")}).then(function(id){switch(id){case"yes":instance.getCurrentPlayer().endSession(),instance.setDefaultPlayerActive();break;case"no":instance.setDefaultPlayerActive()}})}):this.setDefaultPlayerActive()}},PlaybackManager.prototype.sendCommand=function(cmd,player){switch(console.log("MediaController received command: "+cmd.Name),cmd.Name){case"SetRepeatMode":this.setRepeatMode(cmd.Arguments.RepeatMode,player);break;case"VolumeUp":this.volumeUp(player);break;case"VolumeDown":this.volumeDown(player);break;case"Mute":this.setMute(!0,player);break;case"Unmute":this.setMute(!1,player);break;case"ToggleMute":this.toggleMute(player);break;case"SetVolume":this.setVolume(cmd.Arguments.Volume,player);break;case"SetAspectRatio":this.setAspectRatio(cmd.Arguments.AspectRatio,player);break;case"SetBrightness":this.setBrightness(cmd.Arguments.Brightness,player);break;case"SetAudioStreamIndex":this.setAudioStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetSubtitleStreamIndex":this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetMaxStreamingBitrate":break;case"ToggleFullscreen":this.toggleFullscreen(player);break;default:player.sendCommand&&player.sendCommand(cmd)}},new PlaybackManager}); \ No newline at end of file +self.currentItem=function(player){if(!player)throw new Error("player cannot be null");var data=getPlayerData(player);return data.streamInfo?data.streamInfo.item:null},self.currentMediaSource=function(player){if(!player)throw new Error("player cannot be null");var data=getPlayerData(player);return data.streamInfo?data.streamInfo.mediaSource:null},self.getPlayerInfo=function(){var player=self._currentPlayer;if(!player)return null;var target=currentTargetInfo||{};return{name:player.name,isLocalPlayer:player.isLocalPlayer,id:target.id,deviceName:target.deviceName,playableMediaTypes:target.playableMediaTypes,supportedCommands:target.supportedCommands}},self.setActivePlayer=function(player,targetInfo){if("localplayer"===player||"localplayer"===player.name){if(self._currentPlayer&&self._currentPlayer.isLocalPlayer)return;return void setCurrentPlayerInternal(null,null)}if("string"==typeof player&&(player=players.filter(function(p){return p.name===player})[0]),!player)throw new Error("null player");setCurrentPlayerInternal(player,targetInfo)},self.trySetActivePlayer=function(player,targetInfo){if("localplayer"===player||"localplayer"===player.name)return void(self._currentPlayer&&self._currentPlayer.isLocalPlayer);if("string"==typeof player&&(player=players.filter(function(p){return p.name===player})[0]),!player)throw new Error("null player");if(currentPairingId!==targetInfo.id){currentPairingId=targetInfo.id;var promise=player.tryPair?player.tryPair(targetInfo):Promise.resolve();promise.then(function(){setCurrentPlayerInternal(player,targetInfo)},function(){currentPairingId===targetInfo.id&&(currentPairingId=null)})}},self.getTargets=function(){var promises=players.filter(function(p){return!displayPlayerInLocalGroup(p)}).map(getPlayerTargets);return Promise.all(promises).then(function(responses){var targets=[];targets.push({name:globalize.translate("sharedcomponents#HeaderMyDevice"),id:"localplayer",playerName:"localplayer",playableMediaTypes:["Audio","Video","Game"],isLocalPlayer:!0,supportedCommands:getSupportedCommands({isLocalPlayer:!0})});for(var i=0;idatetime.parseISO8601Date(item.EndDate).getTime()||(new Date).getTime()=supported.length&&(index=0),self.setAspectRatio(supported[index].id,player)}},self.setAspectRatio=function(val,player){player=player||self._currentPlayer,player&&player.setAspectRatio&&player.setAspectRatio(val)},self.getSupportedAspectRatios=function(player){return player=player||self._currentPlayer,player&&player.getSupportedAspectRatios?player.getSupportedAspectRatios():[]},self.getAspectRatio=function(player){if(player=player||self._currentPlayer,player&&player.getAspectRatio)return player.getAspectRatio()};var brightnessOsdLoaded;self.setBrightness=function(val,player){player=player||self._currentPlayer,player&&(brightnessOsdLoaded||(brightnessOsdLoaded=!0,require(["brightnessOsd"])),player.setBrightness(val))},self.getBrightness=function(player){if(player=player||self._currentPlayer)return player.getBrightness()},self.setVolume=function(val,player){player=player||self._currentPlayer,player&&player.setVolume(val)},self.getVolume=function(player){if(player=player||self._currentPlayer)return player.getVolume()},self.volumeUp=function(player){player=player||self._currentPlayer,player&&player.volumeUp()},self.volumeDown=function(player){player=player||self._currentPlayer,player&&player.volumeDown()},self.changeAudioStreamIndex=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.changeAudioStreamIndex()},self.changeSubtitleStreamIndex=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.changeSubtitleStreamIndex()},self.getAudioStreamIndex=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getAudioStreamIndex():getPlayerData(player).audioStreamIndex},self.setAudioStreamIndex=function(index,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.setAudioStreamIndex(index):void("Transcode"!==getPlayerData(player).streamInfo.playMethod&&player.canSetAudioStreamIndex()?(player.setAudioStreamIndex(index),getPlayerData(player).audioStreamIndex=index):(changeStream(player,getCurrentTicks(player),{AudioStreamIndex:index}),getPlayerData(player).audioStreamIndex=index))},self.getMaxStreamingBitrate=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getMaxStreamingBitrate():getPlayerData(player).maxStreamingBitrate||appSettings.maxStreamingBitrate()},self.enableAutomaticBitrateDetection=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.enableAutomaticBitrateDetection():appSettings.enableAutomaticBitrateDetection()},self.setMaxStreamingBitrate=function(options,player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.setMaxStreamingBitrate(options);var promise;options.enableAutomaticBitrateDetection?(appSettings.enableAutomaticBitrateDetection(!0),promise=connectionManager.getApiClient(self.currentItem(player).ServerId).detectBitrate(!0)):(appSettings.enableAutomaticBitrateDetection(!1),promise=Promise.resolve(options.maxBitrate)),promise.then(function(bitrate){appSettings.maxStreamingBitrate(bitrate),changeStream(player,getCurrentTicks(player),{MaxStreamingBitrate:bitrate})})},self.isFullscreen=function(player){return player=player||self._currentPlayer,!player.isLocalPlayer||player.isFullscreen?player.isFullscreen():fullscreenManager.isFullScreen()},self.toggleFullscreen=function(player){return player=player||self._currentPlayer,!player.isLocalPlayer||player.toggleFulscreen?player.toggleFulscreen():void(fullscreenManager.isFullScreen()?fullscreenManager.exitFullscreen():fullscreenManager.requestFullscreen())},self.togglePictureInPicture=function(player){return player=player||self._currentPlayer,player.togglePictureInPicture()},self.getSubtitleStreamIndex=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.getSubtitleStreamIndex();if(!player)throw new Error("player cannot be null");return getPlayerData(player).subtitleStreamIndex},self.setSubtitleStreamIndex=function(index,player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.setSubtitleStreamIndex(index);var currentStream=getCurrentSubtitleStream(player),newStream=getSubtitleStream(player,index);if(currentStream||newStream){var selectedTrackElementIndex=-1,currentPlayMethod=(getPlayerData(player).streamInfo||{}).playMethod;currentStream&&!newStream?("Encode"===currentStream.DeliveryMethod||"Embed"===currentStream.DeliveryMethod&&"Transcode"===currentPlayMethod)&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1}):!currentStream&&newStream?"External"===newStream.DeliveryMethod?selectedTrackElementIndex=index:"Embed"===newStream.DeliveryMethod&&"Transcode"!==currentPlayMethod?selectedTrackElementIndex=index:changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index}):currentStream&&newStream&&("External"===newStream.DeliveryMethod||"Embed"===newStream.DeliveryMethod&&"Transcode"!==currentPlayMethod?(selectedTrackElementIndex=index,"External"!==currentStream.DeliveryMethod&&"Embed"!==currentStream.DeliveryMethod&&changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:-1})):changeStream(player,getCurrentTicks(player),{SubtitleStreamIndex:index})),player.setSubtitleStreamIndex(selectedTrackElementIndex),getPlayerData(player).subtitleStreamIndex=index}},self.toggleDisplayMirroring=function(){self.enableDisplayMirroring(!self.enableDisplayMirroring())},self.enableDisplayMirroring=function(enabled){if(null!=enabled){var val=enabled?"1":"0";return void appSettings.set("displaymirror",val)}return"0"!==(appSettings.get("displaymirror")||"")},self.stop=function(player){return player=player||self._currentPlayer,player?(playNextAfterEnded=!1,player.stop(!0,!0)):Promise.resolve()},self.playPause=function(player){if(player=player||self._currentPlayer)return player.playPause?player.playPause():player.paused()?self.unpause(player):self.pause(player)},self.paused=function(player){if(player=player||self._currentPlayer)return player.paused()},self.pause=function(player){player=player||self._currentPlayer,player&&player.pause()},self.unpause=function(player){player=player||self._currentPlayer,player&&player.unpause()},self.seek=function(ticks,player){return ticks=Math.max(0,ticks),player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.seek(ticks):void changeStream(player,ticks)},self.nextChapter=function(player){player=player||self._currentPlayer;var item=self.currentItem(player),ticks=getCurrentTicks(player),nextChapter=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks>ticks})[0];nextChapter?self.seek(nextChapter.StartPositionTicks,player):self.nextTrack(player)},self.previousChapter=function(player){player=player||self._currentPlayer;var item=self.currentItem(player),ticks=getCurrentTicks(player);ticks-=1e8,0===self.getCurrentPlaylistIndex(player)&&(ticks=Math.max(ticks,0));var previousChapters=(item.Chapters||[]).filter(function(i){return i.StartPositionTicks<=ticks});previousChapters.length?self.seek(previousChapters[previousChapters.length-1].StartPositionTicks,player):self.previousTrack(player)},self.fastForward=function(player){if(player=player||self._currentPlayer,null!=player.fastForward)return void player.fastForward(userSettings.skipForwardLength());var ticks=getCurrentTicks(player);ticks+=1e4*userSettings.skipForwardLength();var runTimeTicks=self.duration(player)||0;ticks0||canPlayerSeek(player)),item&&(state.NowPlayingItem=getNowPlayingItemForReporting(player,item,mediaSource)),state.MediaSource=mediaSource,Promise.resolve(state)},self.currentTime=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.currentTime():getCurrentTicks(player)},self.duration=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.duration();if(!player)throw new Error("player cannot be null");var streamInfo=getPlayerData(player).streamInfo;if(streamInfo&&streamInfo.mediaSource&&streamInfo.mediaSource.RunTimeTicks)return streamInfo.mediaSource.RunTimeTicks;var playerDuration=player.duration();return playerDuration&&(playerDuration*=1e4),playerDuration};var currentId=0;self.getSubtitleUrl=function(textStream,serverId){var apiClient=connectionManager.getApiClient(serverId),textStreamUrl=textStream.IsExternalUrl?textStream.DeliveryUrl:apiClient.getUrl(textStream.DeliveryUrl);return textStreamUrl},self.setCurrentPlaylistItem=function(playlistItemId,player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.setCurrentPlaylistItem(playlistItemId);for(var newItem,newItemIndex,i=0,length=playlist.length;i=playlist.length)throw new Error("newIndex out of bounds");moveInArray(playlist,oldIndex,newIndex),events.trigger(player,"playlistitemmove",[{playlistItemId:playlistItemId,newIndex:newIndex}])}},self.getCurrentPlaylistIndex=function(i,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getCurrentPlaylistIndex():findPlaylistIndex(currentPlaylistItemId,playlist)},self.getCurrentPlaylistItemId=function(i,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getCurrentPlaylistItemId():currentPlaylistItemId},self.setRepeatMode=function(value,player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.setRepeatMode(value):(repeatMode=value,void events.trigger(player,"repeatmodechange"))},self.getRepeatMode=function(player){return player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player)?player.getRepeatMode():repeatMode},self.nextTrack=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.nextTrack();var newItemInfo=getNextItemInfo(player);if(newItemInfo){console.log("playing next track");var playOptions=Object.assign({},currentPlayOptions,{startPositionTicks:0});playInternal(newItemInfo.item,playOptions,function(){setPlaylistState(newItemInfo.item.PlaylistItemId,newItemInfo.index)})}},self.previousTrack=function(player){if(player=player||self._currentPlayer,player&&!enableLocalPlaylistManagement(player))return player.previousTrack();var newIndex=self.getCurrentPlaylistIndex(player)-1;if(newIndex>=0){var newItem=playlist[newIndex];if(newItem){var playOptions=Object.assign({},currentPlayOptions,{startPositionTicks:0});playInternal(newItem,playOptions,function(){setPlaylistState(newItem.PlaylistItemId,newIndex)})}}},self.queue=function(options,player){queue(options,"",player)},self.queueNext=function(options,player){queue(options,"next",player)},events.on(pluginManager,"registered",function(e,plugin){"mediaplayer"===plugin.type&&initMediaPlayer(plugin)}),pluginManager.ofType("mediaplayer").map(initMediaPlayer),window.addEventListener("beforeunload",function(e){var player=self._currentPlayer;player&&self.isPlaying(player)&&(playNextAfterEnded=!1,onPlaybackStopped.call(player))}),events.on(serverNotifications,"ServerShuttingDown",function(e,apiClient,data){self.setDefaultPlayerActive()}),events.on(serverNotifications,"ServerRestarting",function(e,apiClient,data){self.setDefaultPlayerActive()})}return PlaybackManager.prototype.trySetActiveDeviceName=function(name){name=normalizeName(name);var instance=this;instance.getTargets().then(function(result){var target=result.filter(function(p){return normalizeName(p.name)===name})[0];target&&instance.trySetActivePlayer(target.playerName,target)})},PlaybackManager.prototype.displayContent=function(options,player){player=player||this._currentPlayer,player&&player.displayContent&&player.displayContent(options)},PlaybackManager.prototype.beginPlayerUpdates=function(player){player.beginPlayerUpdates&&player.beginPlayerUpdates()},PlaybackManager.prototype.endPlayerUpdates=function(player){player.endPlayerUpdates&&player.endPlayerUpdates()},PlaybackManager.prototype.setDefaultPlayerActive=function(){this.setActivePlayer("localplayer")},PlaybackManager.prototype.removeActivePlayer=function(name){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.name===name&&this.setDefaultPlayerActive()},PlaybackManager.prototype.removeActiveTarget=function(id){var playerInfo=this.getPlayerInfo();playerInfo&&playerInfo.id===id&&this.setDefaultPlayerActive()},PlaybackManager.prototype.disconnectFromPlayer=function(){var playerInfo=this.getPlayerInfo();if(playerInfo){var instance=this;playerInfo.supportedCommands.indexOf("EndSession")!==-1?require(["dialog"],function(dialog){var menuItems=[];menuItems.push({name:globalize.translate("ButtonYes"),id:"yes"}),menuItems.push({name:globalize.translate("ButtonNo"),id:"no"}),dialog({buttons:menuItems,text:globalize.translate("ConfirmEndPlayerSession")}).then(function(id){switch(id){case"yes":instance.getCurrentPlayer().endSession(),instance.setDefaultPlayerActive();break;case"no":instance.setDefaultPlayerActive()}})}):this.setDefaultPlayerActive()}},PlaybackManager.prototype.sendCommand=function(cmd,player){switch(console.log("MediaController received command: "+cmd.Name),cmd.Name){case"SetRepeatMode":this.setRepeatMode(cmd.Arguments.RepeatMode,player);break;case"VolumeUp":this.volumeUp(player);break;case"VolumeDown":this.volumeDown(player);break;case"Mute":this.setMute(!0,player);break;case"Unmute":this.setMute(!1,player);break;case"ToggleMute":this.toggleMute(player);break;case"SetVolume":this.setVolume(cmd.Arguments.Volume,player);break;case"SetAspectRatio":this.setAspectRatio(cmd.Arguments.AspectRatio,player);break;case"SetBrightness":this.setBrightness(cmd.Arguments.Brightness,player);break;case"SetAudioStreamIndex":this.setAudioStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetSubtitleStreamIndex":this.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index),player);break;case"SetMaxStreamingBitrate":break;case"ToggleFullscreen":this.toggleFullscreen(player);break;default:player.sendCommand&&player.sendCommand(cmd)}},new PlaybackManager}); \ No newline at end of file diff --git a/dashboard-ui/components/apphost.js b/dashboard-ui/components/apphost.js index ad5f139db3..ed1318c604 100644 --- a/dashboard-ui/components/apphost.js +++ b/dashboard-ui/components/apphost.js @@ -1 +1 @@ -define(["appStorage","browser"],function(appStorage,browser){"use strict";function getBaseProfileOptions(item){var disableHlsVideoAudioCodecs=[];return item&&(!browser.edge&&canPlayNativeHls()||(disableHlsVideoAudioCodecs.push("mp3"),disableHlsVideoAudioCodecs.push("ac3"))),{enableMkvProgressive:!1,disableHlsVideoAudioCodecs:disableHlsVideoAudioCodecs}}function canPlayNativeHls(){var media=document.createElement("video");return!(!media.canPlayType("application/x-mpegURL").replace(/no/,"")&&!media.canPlayType("application/vnd.apple.mpegURL").replace(/no/,""))}function getDeviceProfileForWindowsUwp(item){return new Promise(function(resolve,reject){require(["browserdeviceprofile","environments/windows-uwp/mediacaps"],function(profileBuilder,uwpMediaCaps){var profileOptions=getBaseProfileOptions(item);profileOptions.supportsDts=uwpMediaCaps.supportsDTS(),profileOptions.supportsTrueHd=uwpMediaCaps.supportsDolby(),profileOptions.audioChannels=uwpMediaCaps.getAudioChannels(),resolve(profileBuilder(profileOptions))})})}function getDeviceProfile(item,options){return options=options||{},self.Windows?getDeviceProfileForWindowsUwp(item):new Promise(function(resolve,reject){require(["browserdeviceprofile"],function(profileBuilder){var profile=profileBuilder(getBaseProfileOptions(item));item&&!options.isRetry&&(browser.edge||browser.msie||browser.orsay||browser.tizen||(profile.SubtitleProfiles.push({Format:"ass",Method:"External"}),profile.SubtitleProfiles.push({Format:"ssa",Method:"External"}))),resolve(profile)})})}function getCapabilities(){return getDeviceProfile().then(function(profile){var supportsPersistentIdentifier=!!browser.edgeUwp,caps={PlayableMediaTypes:["Audio","Video"],SupportsPersistentIdentifier:supportsPersistentIdentifier,DeviceProfile:profile};return caps})}function generateDeviceId(){return new Promise(function(resolve,reject){require(["cryptojs-sha1"],function(){var keys=[];keys.push(navigator.userAgent),keys.push((new Date).getTime()),resolve(CryptoJS.SHA1(keys.join("|")).toString())})})}function getDeviceId(){var key="_deviceId2",deviceId=appStorage.getItem(key);return deviceId?Promise.resolve(deviceId):generateDeviceId().then(function(deviceId){return appStorage.setItem(key,deviceId),deviceId})}function getDeviceName(){var deviceName;return deviceName=browser.tizen?"Samsung Smart TV":browser.web0S?"LG Smart TV":browser.operaTv?"Opera TV":browser.xboxOne?"Xbox One":browser.ps4?"Sony PS4":browser.chrome?"Chrome":browser.edge?"Edge":browser.firefox?"Firefox":browser.msie?"Internet Explorer":"Web Browser",browser.ipad?deviceName+=" Ipad":browser.iphone?deviceName+=" Iphone":browser.android&&(deviceName+=" Android"),deviceName}function supportsVoiceInput(){return!browser.tv&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.oSpeechRecognition||window.msSpeechRecognition)}function supportsFullscreen(){if(browser.tv)return!1;var element=document.documentElement;return!!(element.requestFullscreen||element.mozRequestFullScreen||element.webkitRequestFullscreen||element.msRequestFullscreen)||!!document.createElement("video").webkitEnterFullscreen}function getSyncProfile(){return new Promise(function(resolve,reject){require(["browserdeviceprofile","appSettings"],function(profileBuilder,appSettings){var profile=profileBuilder();profile.MaxStaticMusicBitrate=appSettings.maxStaticMusicBitrate(),resolve(profile)})})}function getDefaultLayout(){return"desktop"}function supportsHtmlMediaAutoplay(){if(browser.edgeUwp||browser.tv||browser.ps4||browser.xboxOne)return!0;if(browser.mobile)return!1;var savedResult=appStorage.getItem(htmlMediaAutoplayAppStorageKey);return"true"===savedResult||"false"!==savedResult&&null}var htmlMediaAutoplayAppStorageKey="supportshtmlmediaautoplay0",supportedFeatures=function(){var features=["sharing","externalpremium"];return browser.edgeUwp||browser.tv||browser.xboxOne||browser.ps4||features.push("filedownload"),browser.operaTv||browser.tizen||browser.web0s?features.push("exit"):features.push("exitmenu"),browser.operaTv||features.push("externallinks"),supportsVoiceInput()&&features.push("voiceinput"),supportsHtmlMediaAutoplay()&&(features.push("htmlaudioautoplay"),features.push("htmlvideoautoplay")),window.SyncRegistered,supportsFullscreen()&&features.push("fullscreenchange"),(browser.chrome||browser.edge&&!browser.slow)&&(browser.noAnimation||browser.edgeUwp||browser.xboxOne||features.push("imageanalysis")),Dashboard.isConnectMode()&&features.push("multiserver"),(browser.tv||browser.xboxOne||browser.ps4||browser.mobile)&&features.push("physicalvolumecontrol"),browser.tv||browser.xboxOne||browser.ps4||features.push("remotecontrol"),browser.operaTv||browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp||features.push("remotemedia"),features.push("otherapppromotions"),features.push("targetblank"),features}();supportedFeatures.indexOf("htmlvideoautoplay")===-1&&supportsHtmlMediaAutoplay()!==!1&&require(["autoPlayDetect"],function(autoPlayDetect){autoPlayDetect.supportsHtmlMediaAutoplay().then(function(){appStorage.setItem(htmlMediaAutoplayAppStorageKey,"true"),supportedFeatures.push("htmlvideoautoplay"),supportedFeatures.push("htmlaudioautoplay")},function(){appStorage.setItem(htmlMediaAutoplayAppStorageKey,"false")})});var appInfo,version=window.dashboardVersion||"3.0";return{getWindowState:function(){return document.windowState||"Normal"},setWindowState:function(state){alert("setWindowState is not supported and should not be called")},exit:function(){if(browser.tizen)try{tizen.application.getCurrentApplication().exit()}catch(err){console.log("error closing application: "+err)}else window.close()},supports:function(command){return supportedFeatures.indexOf(command.toLowerCase())!=-1},appInfo:function(){return appInfo?Promise.resolve(appInfo):getDeviceId().then(function(deviceId){return appInfo={deviceId:deviceId,deviceName:getDeviceName(),appName:"Emby Mobile",appVersion:version}})},getCapabilities:getCapabilities,preferVisualCards:browser.android||browser.chrome,moreIcon:browser.safari||browser.edge?"dots-horiz":"dots-vert",getSyncProfile:getSyncProfile,getDefaultLayout:getDefaultLayout,getDeviceProfile:getDeviceProfile}}); \ No newline at end of file +define(["appStorage","browser"],function(appStorage,browser){"use strict";function getBaseProfileOptions(item){var disableHlsVideoAudioCodecs=[];return item&&(!browser.edge&&canPlayNativeHls()||(disableHlsVideoAudioCodecs.push("mp3"),disableHlsVideoAudioCodecs.push("ac3"),disableHlsVideoAudioCodecs.push("eac3"))),{enableMkvProgressive:!1,disableHlsVideoAudioCodecs:disableHlsVideoAudioCodecs}}function canPlayNativeHls(){var media=document.createElement("video");return!(!media.canPlayType("application/x-mpegURL").replace(/no/,"")&&!media.canPlayType("application/vnd.apple.mpegURL").replace(/no/,""))}function getDeviceProfileForWindowsUwp(item){return new Promise(function(resolve,reject){require(["browserdeviceprofile","environments/windows-uwp/mediacaps"],function(profileBuilder,uwpMediaCaps){var profileOptions=getBaseProfileOptions(item);profileOptions.supportsDts=uwpMediaCaps.supportsDTS(),profileOptions.supportsTrueHd=uwpMediaCaps.supportsDolby(),profileOptions.audioChannels=uwpMediaCaps.getAudioChannels(),resolve(profileBuilder(profileOptions))})})}function getDeviceProfile(item,options){return options=options||{},self.Windows?getDeviceProfileForWindowsUwp(item):new Promise(function(resolve,reject){require(["browserdeviceprofile"],function(profileBuilder){var profile=profileBuilder(getBaseProfileOptions(item));item&&!options.isRetry&&(browser.edge||browser.msie||browser.orsay||browser.tizen||(profile.SubtitleProfiles.push({Format:"ass",Method:"External"}),profile.SubtitleProfiles.push({Format:"ssa",Method:"External"}))),resolve(profile)})})}function getCapabilities(){return getDeviceProfile().then(function(profile){var supportsPersistentIdentifier=!!browser.edgeUwp,caps={PlayableMediaTypes:["Audio","Video"],SupportsPersistentIdentifier:supportsPersistentIdentifier,DeviceProfile:profile};return caps})}function generateDeviceId(){return new Promise(function(resolve,reject){require(["cryptojs-sha1"],function(){var keys=[];keys.push(navigator.userAgent),keys.push((new Date).getTime()),resolve(CryptoJS.SHA1(keys.join("|")).toString())})})}function getDeviceId(){var key="_deviceId2",deviceId=appStorage.getItem(key);return deviceId?Promise.resolve(deviceId):generateDeviceId().then(function(deviceId){return appStorage.setItem(key,deviceId),deviceId})}function getDeviceName(){var deviceName;return deviceName=browser.tizen?"Samsung Smart TV":browser.web0S?"LG Smart TV":browser.operaTv?"Opera TV":browser.xboxOne?"Xbox One":browser.ps4?"Sony PS4":browser.chrome?"Chrome":browser.edge?"Edge":browser.firefox?"Firefox":browser.msie?"Internet Explorer":"Web Browser",browser.ipad?deviceName+=" Ipad":browser.iphone?deviceName+=" Iphone":browser.android&&(deviceName+=" Android"),deviceName}function supportsVoiceInput(){return!browser.tv&&(window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.oSpeechRecognition||window.msSpeechRecognition)}function supportsFullscreen(){if(browser.tv)return!1;var element=document.documentElement;return!!(element.requestFullscreen||element.mozRequestFullScreen||element.webkitRequestFullscreen||element.msRequestFullscreen)||!!document.createElement("video").webkitEnterFullscreen}function getSyncProfile(){return new Promise(function(resolve,reject){require(["browserdeviceprofile","appSettings"],function(profileBuilder,appSettings){var profile=profileBuilder();profile.MaxStaticMusicBitrate=appSettings.maxStaticMusicBitrate(),resolve(profile)})})}function getDefaultLayout(){return"desktop"}function supportsHtmlMediaAutoplay(){if(browser.edgeUwp||browser.tv||browser.ps4||browser.xboxOne)return!0;if(browser.mobile)return!1;var savedResult=appStorage.getItem(htmlMediaAutoplayAppStorageKey);return"true"===savedResult||"false"!==savedResult&&null}var htmlMediaAutoplayAppStorageKey="supportshtmlmediaautoplay0",supportedFeatures=function(){var features=["sharing","externalpremium"];return browser.edgeUwp||browser.tv||browser.xboxOne||browser.ps4||features.push("filedownload"),browser.operaTv||browser.tizen||browser.web0s?features.push("exit"):features.push("exitmenu"),browser.operaTv||features.push("externallinks"),supportsVoiceInput()&&features.push("voiceinput"),supportsHtmlMediaAutoplay()&&(features.push("htmlaudioautoplay"),features.push("htmlvideoautoplay")),window.SyncRegistered,supportsFullscreen()&&features.push("fullscreenchange"),(browser.chrome||browser.edge&&!browser.slow)&&(browser.noAnimation||browser.edgeUwp||browser.xboxOne||features.push("imageanalysis")),Dashboard.isConnectMode()&&features.push("multiserver"),(browser.tv||browser.xboxOne||browser.ps4||browser.mobile)&&features.push("physicalvolumecontrol"),browser.tv||browser.xboxOne||browser.ps4||features.push("remotecontrol"),browser.operaTv||browser.tizen||browser.orsay||browser.web0s||browser.edgeUwp||features.push("remotemedia"),features.push("otherapppromotions"),features.push("targetblank"),features}();supportedFeatures.indexOf("htmlvideoautoplay")===-1&&supportsHtmlMediaAutoplay()!==!1&&require(["autoPlayDetect"],function(autoPlayDetect){autoPlayDetect.supportsHtmlMediaAutoplay().then(function(){appStorage.setItem(htmlMediaAutoplayAppStorageKey,"true"),supportedFeatures.push("htmlvideoautoplay"),supportedFeatures.push("htmlaudioautoplay")},function(){appStorage.setItem(htmlMediaAutoplayAppStorageKey,"false")})});var appInfo,version=window.dashboardVersion||"3.0";return{getWindowState:function(){return document.windowState||"Normal"},setWindowState:function(state){alert("setWindowState is not supported and should not be called")},exit:function(){if(browser.tizen)try{tizen.application.getCurrentApplication().exit()}catch(err){console.log("error closing application: "+err)}else window.close()},supports:function(command){return supportedFeatures.indexOf(command.toLowerCase())!=-1},appInfo:function(){return appInfo?Promise.resolve(appInfo):getDeviceId().then(function(deviceId){return appInfo={deviceId:deviceId,deviceName:getDeviceName(),appName:"Emby Mobile",appVersion:version}})},getCapabilities:getCapabilities,preferVisualCards:browser.android||browser.chrome,moreIcon:browser.safari||browser.edge?"dots-horiz":"dots-vert",getSyncProfile:getSyncProfile,getDefaultLayout:getDefaultLayout,getDeviceProfile:getDeviceProfile}}); \ No newline at end of file diff --git a/dashboard-ui/scheduledtask.html b/dashboard-ui/scheduledtask.html index 7aa16e8486..b2f308583b 100644 --- a/dashboard-ui/scheduledtask.html +++ b/dashboard-ui/scheduledtask.html @@ -45,9 +45,9 @@
-
- -
+
+