1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add autoplay detection

This commit is contained in:
Luke Pulverenti 2017-01-29 18:46:52 -05:00
parent 0d09b37cbb
commit 38ab72abf3
13 changed files with 14 additions and 13 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
.actionSheet,.actionSheetContent{display:-webkit-box;display:-webkit-flex}.actionSheetContent,.actionSheetScroller{-webkit-box-orient:vertical;-webkit-box-direction:normal}.actionSheet{display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;padding:0;border:none;max-height:84%;-webkit-border-radius:1px!important;border-radius:1px!important;color:#fff}.actionsheet-not-fullscreen{background-color:#121314;max-width:90%;max-height:90%;color:#eee}.actionSheetMenuItem:hover{background-color:#222}.actionsheet-fullscreen{max-height:none;-webkit-border-radius:0!important;border-radius:0!important}.actionSheetContent-centered{text-align:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.actionSheetContent{margin:0!important;padding:.4em 0!important;-webkit-flex-direction:column;flex-direction:column;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-align:center;overflow:hidden}.actionSheetMenuItem{padding:0 1.6em;margin:0;text-transform:none;text-align:inherit;display:-webkit-box;display:-webkit-flex;display:flex;font-weight:inherit;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-shrink:0;flex-shrink:0;background:0 0;-webkit-box-shadow:none;box-shadow:none}.actionSheetMenuItem:focus{-webkit-transform:none!important;transform:none!important}.actionSheetMenuItem-noflex{display:block}.actionSheetItemText{padding:.7em 0;white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;vertical-align:middle}.actionSheetItemText-extraspacing{padding:.9em 0}.emby-button-noflex .actionSheetItemText{display:inline-block}.actionSheetItemIcon{margin-right:1.5em!important}.actionSheetScroller{margin-bottom:0!important;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;width:100%}.layout-tv .actionSheetScroller{max-height:64%;max-width:60%;width:auto}.actionSheetTitle{margin:.5em 0!important;padding:0 1em;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.actionSheetText{padding:0 1em;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.actionsheet-extraSpacing{font-size:112%}.btnCloseActionSheet{position:fixed;top:.75em;left:.5em}
.actionSheet,.actionSheetContent{display:-webkit-box;display:-webkit-flex}.actionSheetContent,.actionSheetScroller{-webkit-box-orient:vertical;-webkit-box-direction:normal}.actionSheet{display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;padding:0;border:none;max-height:84%;-webkit-border-radius:1px!important;border-radius:1px!important;color:#fff}.actionsheet-not-fullscreen{background-color:#121314;max-width:90%;max-height:90%;color:#eee}.actionSheetMenuItem:hover{background-color:#222}.actionsheet-fullscreen{max-height:none;-webkit-border-radius:0!important;border-radius:0!important}.actionSheetContent-centered{text-align:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.actionSheetContent{margin:0!important;padding:.4em 0!important;-webkit-flex-direction:column;flex-direction:column;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;-webkit-box-align:center;-webkit-align-items:center;align-items:center;text-align:center;overflow:hidden}.actionSheetMenuItem{padding:.7em 1.6em;margin:0;text-transform:none;text-align:inherit;display:-webkit-box;display:-webkit-flex;display:flex;font-weight:inherit;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-shrink:0;flex-shrink:0;background:0 0;-webkit-box-shadow:none;box-shadow:none}.actionSheetMenuItem:focus{-webkit-transform:none!important;transform:none!important}.actionSheetMenuItem-noflex{display:block}.actionSheetMenuItem-extraspacing{padding:.9em 1.6em}.actionSheetItemText{white-space:nowrap;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;vertical-align:middle;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start}.actionSheetItemSecondaryText{opacity:.7;font-size:90%;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;-webkit-flex-shrink:0;flex-shrink:0;margin-left:5em}.emby-button-noflex .actionSheetItemText{display:inline-block}.actionSheetItemIcon{margin-right:1.5em!important}.actionSheetScroller{margin-bottom:0!important;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;width:100%}.layout-tv .actionSheetScroller{max-height:64%;max-width:60%;width:auto}.actionSheetTitle{margin:.5em 0!important;padding:0 1em;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.actionSheetText{padding:0 1em;-webkit-box-flex:0;-webkit-flex-grow:0;flex-grow:0}.actionsheet-extraSpacing{font-size:112%}.btnCloseActionSheet{position:fixed;top:.75em;left:.5em}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
define([],function(){"use strict";function supportsHtmlMediaAutoplay(){return new Promise(function(resolve,reject){var timeout,elem=document.createElement("video"),elemStyle=elem.style;if(!("autoplay"in elem))return void resolve(!1);elemStyle.position="absolute",elemStyle.height=0,elemStyle.width=0;try{elem.src="data:video/mp4;base64,AAAAHGZ0eXBtcDQyAAAAAG1wNDJpc29tYXZjMQAAAz5tb292AAAAbG12aGQAAAAAzaNacc2jWnEAAV+QAAFfkAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAGGlvZHMAAAAAEICAgAcAT////3//AAACQ3RyYWsAAABcdGtoZAAAAAHNo1pxzaNacQAAAAEAAAAAAAFfkAAAAAAAAAAAAAAAAAA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uYWx5c2U9MHgxOjAgbWU9ZXNhIHN1Ym1lPTkgcHN5PTAgbWl4ZWRfcmVmPTAgbWVfcmFuZ2U9NCBjaHJvbWFfbWU9MSB0cmVsbGlzPTAgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0wIGNocm9tYV9xcF9vZmZzZXQ9MCB0aHJlYWRzPTYgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTUwIGtleWludF9taW49NSBzY2VuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmM9Y3FwIG1idHJlZT0wIHFwPTAAgAAAAD5liISscR8A+E4ACAACFoAAITAAAgsAAPgYCoKgoC+L4vi+KAvi+L4YfAEAACMzgABF9AAEUGUgABDJiXnf4AAAAARBmiKUAAAABEGaQpQAAAAEQZpilAAAAARBmoKU"}catch(e){return void resolve(!1)}elem.setAttribute("autoplay",""),elem.style="display:none",document.body.appendChild(elem);var testAutoplay=function(arg){clearTimeout(timeout),elem.removeEventListener("playing",testAutoplay);var supported=arg&&"playing"===arg.type||0!==elem.currentTime;elem.parentNode.removeChild(elem),supported?resolve():reject()};elem.addEventListener("playing",testAutoplay),timeout=setTimeout(testAutoplay,400)})}return{supportsHtmlMediaAutoplay:supportsHtmlMediaAutoplay}});

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
define(["actionsheet","datetime","playbackManager","globalize","appSettings","qualityoptions"],function(actionsheet,datetime,playbackManager,globalize,appSettings,qualityoptions){"use strict";function showQualityMenu(player,btn){var videoStream=playbackManager.currentMediaSource(player).MediaStreams.filter(function(stream){return"Video"===stream.Type})[0],videoWidth=videoStream?videoStream.Width:null,options=qualityoptions.getVideoQualityOptions(playbackManager.getMaxStreamingBitrate(player),videoWidth),menuItems=options.map(function(o){var opt={name:o.name,id:o.bitrate};return o.selected&&(opt.selected=!0),opt}),selectedId=options.filter(function(o){return o.selected});return selectedId=selectedId.length?selectedId[0].bitrate:null,actionsheet.show({items:menuItems,positionTo:btn}).then(function(id){var bitrate=parseInt(id);bitrate!==selectedId&&playbackManager.setMaxStreamingBitrate(bitrate,player)})}function show(options){var player=options.player;options.mediaType;return showQualityMenu(player,options.positionTo)}return{show:show}});
define(["actionsheet","datetime","playbackManager","globalize","appSettings","qualityoptions"],function(actionsheet,datetime,playbackManager,globalize,appSettings,qualityoptions){"use strict";function showQualityMenu(player,btn){var videoStream=playbackManager.currentMediaSource(player).MediaStreams.filter(function(stream){return"Video"===stream.Type})[0],videoWidth=videoStream?videoStream.Width:null,options=qualityoptions.getVideoQualityOptions({currentMaxBitrate:playbackManager.getMaxStreamingBitrate(player),isAutomaticBitrateEnabled:playbackManager.enableAutomaticBitrateDetection(player),videoWidth:videoWidth,enableAuto:!0}),menuItems=options.map(function(o){var opt={name:o.name,id:o.bitrate,secondaryText:o.secondaryText};return o.selected&&(opt.selected=!0),opt}),selectedId=options.filter(function(o){return o.selected});return selectedId=selectedId.length?selectedId[0].bitrate:null,actionsheet.show({items:menuItems,positionTo:btn}).then(function(id){var bitrate=parseInt(id);bitrate!==selectedId&&playbackManager.setMaxStreamingBitrate({enableAutomaticBitrateDetection:!bitrate,maxBitrate:bitrate},player)})}function showSettingsMenu(player,btn){}function getQualitySecondaryText(player){return playbackManager.getPlayerState(player).then(function(state){var videoStream=(playbackManager.enableAutomaticBitrateDetection(player),playbackManager.getMaxStreamingBitrate(player),playbackManager.currentMediaSource(player).MediaStreams.filter(function(stream){return"Video"===stream.Type})[0]),videoWidth=videoStream?videoStream.Width:null,options=qualityoptions.getVideoQualityOptions({currentMaxBitrate:playbackManager.getMaxStreamingBitrate(player),isAutomaticBitrateEnabled:playbackManager.enableAutomaticBitrateDetection(player),videoWidth:videoWidth,enableAuto:!0}),selectedOption=(options.map(function(o){var opt={name:o.name,id:o.bitrate,secondaryText:o.secondaryText};return o.selected&&(opt.selected=!0),opt}),options.filter(function(o){return o.selected}));if(!selectedOption.length)return null;selectedOption=selectedOption[0];var text=selectedOption.name;return selectedOption.autoText&&(text+=state.PlayState&&"Transcode"!==state.PlayState.PlayMethod?" - Direct":" "+selectedOption.autoText),text})}function show(options){var player=options.player;return getQualitySecondaryText(player).then(function(secondaryQualityText){var menuItems=(options.mediaType,[]);return menuItems.push({name:globalize.translate("sharedcomponents#Quality"),id:"quality",secondaryText:secondaryQualityText}),actionsheet.show({items:menuItems,positionTo:options.positionTo}).then(function(id){switch(id){case"quality":return showQualityMenu(player,options.positionTo);case"settings":return showSettingsMenu(player,options.positionTo)}return Promise.reject()})})}return{show:show}});

View file

@ -1 +1 @@
define([],function(){"use strict";function getVideoQualityOptions(maxStreamingBitrate,videoWidth){var maxAllowedWidth=videoWidth||4096,options=[];if(maxAllowedWidth>=3800&&(options.push({name:"4K - 120Mbps",maxHeight:2160,bitrate:12e7}),options.push({name:"4K - 100Mbps",maxHeight:2160,bitrate:1e8}),options.push({name:"4K - 80Mbps",maxHeight:2160,bitrate:8e7})),maxAllowedWidth>=1900?(options.push({name:"1080p - 60Mbps",maxHeight:1080,bitrate:6e7}),options.push({name:"1080p - 50Mbps",maxHeight:1080,bitrate:5e7}),options.push({name:"1080p - 40Mbps",maxHeight:1080,bitrate:4e7}),options.push({name:"1080p - 30Mbps",maxHeight:1080,bitrate:3e7}),options.push({name:"1080p - 25Mbps",maxHeight:1080,bitrate:25e6}),options.push({name:"1080p - 20Mbps",maxHeight:1080,bitrate:2e7}),options.push({name:"1080p - 15Mbps",maxHeight:1080,bitrate:15e6}),options.push({name:"1080p - 10Mbps",maxHeight:1080,bitrate:10000001}),options.push({name:"1080p - 8Mbps",maxHeight:1080,bitrate:8000001}),options.push({name:"1080p - 6Mbps",maxHeight:1080,bitrate:6000001}),options.push({name:"1080p - 5Mbps",maxHeight:1080,bitrate:5000001}),options.push({name:"1080p - 4Mbps",maxHeight:1080,bitrate:4000002})):maxAllowedWidth>=1260?(options.push({name:"720p - 10Mbps",maxHeight:720,bitrate:1e7}),options.push({name:"720p - 8Mbps",maxHeight:720,bitrate:8e6}),options.push({name:"720p - 6Mbps",maxHeight:720,bitrate:6e6}),options.push({name:"720p - 5Mbps",maxHeight:720,bitrate:5e6})):maxAllowedWidth>=620&&(options.push({name:"480p - 4Mbps",maxHeight:480,bitrate:4000001}),options.push({name:"480p - 3Mbps",maxHeight:480,bitrate:3000001}),options.push({name:"480p - 2.5Mbps",maxHeight:480,bitrate:25e5}),options.push({name:"480p - 2Mbps",maxHeight:480,bitrate:2000001}),options.push({name:"480p - 1.5Mbps",maxHeight:480,bitrate:1500001})),maxAllowedWidth>=1260&&(options.push({name:"720p - 4Mbps",maxHeight:720,bitrate:4e6}),options.push({name:"720p - 3Mbps",maxHeight:720,bitrate:3e6}),options.push({name:"720p - 2Mbps",maxHeight:720,bitrate:2e6}),options.push({name:"720p - 1.5Mbps",maxHeight:720,bitrate:15e5}),options.push({name:"720p - 1Mbps",maxHeight:720,bitrate:1000001})),options.push({name:"480p - 1.0Mbps",maxHeight:480,bitrate:1e6}),options.push({name:"480p - 720kbps",maxHeight:480,bitrate:72e4}),options.push({name:"480p - 420kbps",maxHeight:480,bitrate:42e4}),options.push({name:"360p",maxHeight:360,bitrate:4e5}),options.push({name:"240p",maxHeight:240,bitrate:32e4}),options.push({name:"144p",maxHeight:144,bitrate:192e3}),maxStreamingBitrate){for(var selectedIndex=-1,i=0,length=options.length;i<length;i++){var option=options[i];selectedIndex===-1&&option.bitrate<=maxStreamingBitrate&&(selectedIndex=i)}selectedIndex===-1&&(selectedIndex=options.length-1),options[selectedIndex].selected=!0}return options}return{getVideoQualityOptions:getVideoQualityOptions}});
define(["globalize"],function(globalize){"use strict";function getVideoQualityOptions(options){var maxStreamingBitrate=options.currentMaxBitrate,videoWidth=options.videoWidth,maxAllowedWidth=videoWidth||4096,qualityOptions=[];maxAllowedWidth>=3800&&(qualityOptions.push({name:"4K - 120Mbps",maxHeight:2160,bitrate:12e7}),qualityOptions.push({name:"4K - 100Mbps",maxHeight:2160,bitrate:1e8}),qualityOptions.push({name:"4K - 80Mbps",maxHeight:2160,bitrate:8e7})),maxAllowedWidth>=1900?(qualityOptions.push({name:"1080p - 60Mbps",maxHeight:1080,bitrate:6e7}),qualityOptions.push({name:"1080p - 50Mbps",maxHeight:1080,bitrate:5e7}),qualityOptions.push({name:"1080p - 40Mbps",maxHeight:1080,bitrate:4e7}),qualityOptions.push({name:"1080p - 30Mbps",maxHeight:1080,bitrate:3e7}),qualityOptions.push({name:"1080p - 25Mbps",maxHeight:1080,bitrate:25e6}),qualityOptions.push({name:"1080p - 20Mbps",maxHeight:1080,bitrate:2e7}),qualityOptions.push({name:"1080p - 15Mbps",maxHeight:1080,bitrate:15e6}),qualityOptions.push({name:"1080p - 10Mbps",maxHeight:1080,bitrate:10000001}),qualityOptions.push({name:"1080p - 8Mbps",maxHeight:1080,bitrate:8000001}),qualityOptions.push({name:"1080p - 6Mbps",maxHeight:1080,bitrate:6000001}),qualityOptions.push({name:"1080p - 5Mbps",maxHeight:1080,bitrate:5000001}),qualityOptions.push({name:"1080p - 4Mbps",maxHeight:1080,bitrate:4000002})):maxAllowedWidth>=1260?(qualityOptions.push({name:"720p - 10Mbps",maxHeight:720,bitrate:1e7}),qualityOptions.push({name:"720p - 8Mbps",maxHeight:720,bitrate:8e6}),qualityOptions.push({name:"720p - 6Mbps",maxHeight:720,bitrate:6e6}),qualityOptions.push({name:"720p - 5Mbps",maxHeight:720,bitrate:5e6})):maxAllowedWidth>=620&&(qualityOptions.push({name:"480p - 4Mbps",maxHeight:480,bitrate:4000001}),qualityOptions.push({name:"480p - 3Mbps",maxHeight:480,bitrate:3000001}),qualityOptions.push({name:"480p - 2.5Mbps",maxHeight:480,bitrate:25e5}),qualityOptions.push({name:"480p - 2Mbps",maxHeight:480,bitrate:2000001}),qualityOptions.push({name:"480p - 1.5Mbps",maxHeight:480,bitrate:1500001})),maxAllowedWidth>=1260&&(qualityOptions.push({name:"720p - 4Mbps",maxHeight:720,bitrate:4e6}),qualityOptions.push({name:"720p - 3Mbps",maxHeight:720,bitrate:3e6}),qualityOptions.push({name:"720p - 2Mbps",maxHeight:720,bitrate:2e6}),qualityOptions.push({name:"720p - 1.5Mbps",maxHeight:720,bitrate:15e5}),qualityOptions.push({name:"720p - 1Mbps",maxHeight:720,bitrate:1000001})),qualityOptions.push({name:"480p - 1.0Mbps",maxHeight:480,bitrate:1e6}),qualityOptions.push({name:"480p - 720kbps",maxHeight:480,bitrate:72e4}),qualityOptions.push({name:"480p - 420kbps",maxHeight:480,bitrate:42e4}),qualityOptions.push({name:"360p",maxHeight:360,bitrate:4e5}),qualityOptions.push({name:"240p",maxHeight:240,bitrate:32e4}),qualityOptions.push({name:"144p",maxHeight:144,bitrate:192e3});var autoQualityOption={name:globalize.translate("sharedcomponents#Auto"),bitrate:0,selected:options.isAutomaticBitrateEnabled};if(options.enableAuto&&qualityOptions.push(autoQualityOption),maxStreamingBitrate){for(var selectedIndex=-1,i=0,length=qualityOptions.length;i<length;i++){var option=qualityOptions[i];selectedIndex===-1&&option.bitrate<=maxStreamingBitrate&&(selectedIndex=i)}selectedIndex===-1&&(selectedIndex=qualityOptions.length-1);var currentQualityOption=qualityOptions[selectedIndex];options.isAutomaticBitrateEnabled?autoQualityOption.autoText=currentQualityOption.name:currentQualityOption.selected=!0}return qualityOptions}return{getVideoQualityOptions:getVideoQualityOptions}});

File diff suppressed because one or more lines are too long