update video osd

This commit is contained in:
Luke Pulverenti 2017-01-03 14:37:10 -05:00
parent afb01571ff
commit f80fcc874a
16 changed files with 513 additions and 67 deletions

View File

@ -14,12 +14,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.4.435", "version": "1.4.437",
"_release": "1.4.435", "_release": "1.4.437",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.4.435", "tag": "1.4.437",
"commit": "d52f0c49c295ba00eb4b6f5172a0dfc75f8e9954" "commit": "511296d852a7375418f99bfbb7a392ba07f436be"
}, },
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1", "_target": "^1.2.1",

View File

@ -796,6 +796,10 @@
}); });
}; };
self.audioTracks = function () {
return [];
};
self.setAudioStreamIndex = function (index) { self.setAudioStreamIndex = function (index) {
castPlayer.sendMessage({ castPlayer.sendMessage({
options: { options: {
@ -805,6 +809,10 @@
}); });
}; };
self.subtitleTracks = function () {
return [];
};
self.setSubtitleStreamIndex = function (index) { self.setSubtitleStreamIndex = function (index) {
castPlayer.sendMessage({ castPlayer.sendMessage({
options: { options: {

View File

@ -0,0 +1,341 @@
// # The MIT License (MIT)
// #
// # Copyright (c) 2016 Microsoft. All rights reserved.
// #
// # Permission is hereby granted, free of charge, to any person obtaining a copy
// # of this software and associated documentation files (the "Software"), to deal
// # in the Software without restriction, including without limitation the rights
// # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// # copies of the Software, and to permit persons to whom the Software is
// # furnished to do so, subject to the following conditions:
// #
// # The above copyright notice and this permission notice shall be included in
// # all copies or substantial portions of the Software.
// #
// # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// # THE SOFTWARE.
(function () {
"use strict";
var _GAMEPAD_A_BUTTON_INDEX = 0,
_GAMEPAD_B_BUTTON_INDEX = 1,
_GAMEPAD_DPAD_UP_BUTTON_INDEX = 12,
_GAMEPAD_DPAD_DOWN_BUTTON_INDEX = 13,
_GAMEPAD_DPAD_LEFT_BUTTON_INDEX = 14,
_GAMEPAD_DPAD_RIGHT_BUTTON_INDEX = 15,
_GAMEPAD_A_KEY = "GamepadA",
_GAMEPAD_B_KEY = "GamepadB",
_GAMEPAD_DPAD_UP_KEY = "GamepadDPadUp",
_GAMEPAD_DPAD_DOWN_KEY = "GamepadDPadDown",
_GAMEPAD_DPAD_LEFT_KEY = "GamepadDPadLeft",
_GAMEPAD_DPAD_RIGHT_KEY = "GamepadDPadRight",
_GAMEPAD_LEFT_THUMBSTICK_UP_KEY = "GamepadLeftThumbStickUp",
_GAMEPAD_LEFT_THUMBSTICK_DOWN_KEY = "GamepadLeftThumbStickDown",
_GAMEPAD_LEFT_THUMBSTICK_LEFT_KEY = "GamepadLeftThumbStickLeft",
_GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEY = "GamepadLeftThumbStickRight",
_GAMEPAD_A_KEYCODE = 0,
_GAMEPAD_B_KEYCODE = 27,
_GAMEPAD_DPAD_UP_KEYCODE = 38,
_GAMEPAD_DPAD_DOWN_KEYCODE = 40,
_GAMEPAD_DPAD_LEFT_KEYCODE = 37,
_GAMEPAD_DPAD_RIGHT_KEYCODE = 39,
_GAMEPAD_LEFT_THUMBSTICK_UP_KEYCODE = 38,
_GAMEPAD_LEFT_THUMBSTICK_DOWN_KEYCODE = 40,
_GAMEPAD_LEFT_THUMBSTICK_LEFT_KEYCODE = 37,
_GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEYCODE = 39,
_THUMB_STICK_THRESHOLD = 0.75;
var _leftThumbstickUpPressed = false,
_leftThumbstickDownPressed = false,
_leftThumbstickLeftPressed = false,
_leftThumbstickRightPressed = false,
_dPadUpPressed = false,
_dPadDownPressed = false,
_dPadLeftPressed = false,
_dPadRightPressed = false,
_gamepadAPressed = false,
_gamepadBPressed = false;
// The set of buttons on the gamepad we listen for.
var ProcessedButtons = [
_GAMEPAD_DPAD_UP_BUTTON_INDEX,
_GAMEPAD_DPAD_DOWN_BUTTON_INDEX,
_GAMEPAD_DPAD_LEFT_BUTTON_INDEX,
_GAMEPAD_DPAD_RIGHT_BUTTON_INDEX,
_GAMEPAD_A_BUTTON_INDEX,
_GAMEPAD_B_BUTTON_INDEX
];
var _ButtonPressedState = {};
_ButtonPressedState.getgamepadA = function () {
return _gamepadAPressed;
};
_ButtonPressedState.setgamepadA = function (newPressedState) {
raiseKeyEvent(_gamepadAPressed, newPressedState, _GAMEPAD_A_KEY, _GAMEPAD_A_KEYCODE, false, true);
_gamepadAPressed = newPressedState;
};
_ButtonPressedState.getgamepadB = function () {
return _gamepadBPressed;
};
_ButtonPressedState.setgamepadB = function (newPressedState) {
raiseKeyEvent(_gamepadBPressed, newPressedState, _GAMEPAD_B_KEY, _GAMEPAD_B_KEYCODE);
_gamepadBPressed = newPressedState;
};
_ButtonPressedState.getleftThumbstickUp = function () {
return _leftThumbstickUpPressed;
};
_ButtonPressedState.setleftThumbstickUp = function (newPressedState) {
raiseKeyEvent(_leftThumbstickUpPressed, newPressedState, _GAMEPAD_LEFT_THUMBSTICK_UP_KEY, _GAMEPAD_LEFT_THUMBSTICK_UP_KEYCODE, true);
_leftThumbstickUpPressed = newPressedState;
};
_ButtonPressedState.getleftThumbstickDown = function () {
return _leftThumbstickDownPressed;
};
_ButtonPressedState.setleftThumbstickDown = function (newPressedState) {
raiseKeyEvent(_leftThumbstickDownPressed, newPressedState, _GAMEPAD_LEFT_THUMBSTICK_DOWN_KEY, _GAMEPAD_LEFT_THUMBSTICK_DOWN_KEYCODE, true);
_leftThumbstickDownPressed = newPressedState;
};
_ButtonPressedState.getleftThumbstickLeft = function () {
return _leftThumbstickLeftPressed;
};
_ButtonPressedState.setleftThumbstickLeft = function (newPressedState) {
raiseKeyEvent(_leftThumbstickLeftPressed, newPressedState, _GAMEPAD_LEFT_THUMBSTICK_LEFT_KEY, _GAMEPAD_LEFT_THUMBSTICK_LEFT_KEYCODE, true);
_leftThumbstickLeftPressed = newPressedState;
};
_ButtonPressedState.getleftThumbstickRight = function () {
return _leftThumbstickRightPressed;
};
_ButtonPressedState.setleftThumbstickRight = function (newPressedState) {
raiseKeyEvent(_leftThumbstickRightPressed, newPressedState, _GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEY, _GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEYCODE, true);
_leftThumbstickRightPressed = newPressedState;
};
_ButtonPressedState.getdPadUp = function () {
return _dPadUpPressed;
};
_ButtonPressedState.setdPadUp = function (newPressedState) {
raiseKeyEvent(_dPadUpPressed, newPressedState, _GAMEPAD_DPAD_UP_KEY, _GAMEPAD_DPAD_UP_KEYCODE, true);
_dPadUpPressed = newPressedState;
};
_ButtonPressedState.getdPadDown = function () {
return _dPadDownPressed;
};
_ButtonPressedState.setdPadDown = function (newPressedState) {
raiseKeyEvent(_dPadDownPressed, newPressedState, _GAMEPAD_DPAD_DOWN_KEY, _GAMEPAD_DPAD_DOWN_KEYCODE, true);
_dPadDownPressed = newPressedState;
};
_ButtonPressedState.getdPadLeft = function () {
return _dPadLeftPressed;
};
_ButtonPressedState.setdPadLeft = function (newPressedState) {
raiseKeyEvent(_dPadLeftPressed, newPressedState, _GAMEPAD_DPAD_LEFT_KEY, _GAMEPAD_DPAD_LEFT_KEYCODE, true);
_dPadLeftPressed = newPressedState;
};
_ButtonPressedState.getdPadRight = function () {
return _dPadRightPressed;
};
_ButtonPressedState.setdPadRight = function (newPressedState) {
raiseKeyEvent(_dPadRightPressed, newPressedState, _GAMEPAD_DPAD_RIGHT_KEY, _GAMEPAD_DPAD_RIGHT_KEYCODE, true);
_dPadRightPressed = newPressedState;
};
var times = {};
function throttle(key) {
var time = times[key] || 0;
var now = new Date().getTime();
if ((now - time) >= 200) {
//times[key] = now;
return true;
}
return false;
}
function resetThrottle(key) {
times[key] = new Date().getTime();
}
function raiseEvent(name, key, keyCode) {
var event = document.createEvent('Event');
event.initEvent(name, true, true);
event.key = key;
event.keyCode = keyCode;
(document.activeElement || document.body).dispatchEvent(event);
}
function raiseKeyEvent(oldPressedState, newPressedState, key, keyCode, enableRepeatKeyDown, clickonKeyUp) {
// No-op if oldPressedState === newPressedState
if (newPressedState === true) {
// button down
var fire = false;
// always fire if this is the initial down press
if (oldPressedState === false) {
fire = true;
resetThrottle(key);
} else if (enableRepeatKeyDown) {
fire = throttle(key);
}
if (fire && keyCode) {
raiseEvent("keydown", key, keyCode);
}
} else if (newPressedState === false && oldPressedState === true) {
resetThrottle(key);
// button up
if (keyCode) {
raiseEvent("keyup", key, keyCode);
}
if (clickonKeyUp) {
(document.activeElement || window).click();
}
}
}
function runInputLoop() {
// Get the latest gamepad state.
var gamepads;
if (navigator.getGamepads) {
gamepads = navigator.getGamepads();
} else if (navigator.webkitGetGamepads) {
gamepads = navigator.webkitGetGamepads();
}
gamepads = gamepads || [];
var i, j, len;
for (i = 0, len = gamepads.length; i < len; i++) {
var gamepad = gamepads[i];
if (gamepad) {
// Iterate through the axes
var axes = gamepad.axes;
var leftStickX = axes[0];
var leftStickY = axes[1];
if (leftStickX > _THUMB_STICK_THRESHOLD) { // Right
_ButtonPressedState.setleftThumbstickRight(true);
} else if (leftStickX < -_THUMB_STICK_THRESHOLD) { // Left
_ButtonPressedState.setleftThumbstickLeft(true);
} else if (leftStickY < -_THUMB_STICK_THRESHOLD) { // Up
_ButtonPressedState.setleftThumbstickUp(true);
} else if (leftStickY > _THUMB_STICK_THRESHOLD) { // Down
_ButtonPressedState.setleftThumbstickDown(true);
} else {
_ButtonPressedState.setleftThumbstickLeft(false);
_ButtonPressedState.setleftThumbstickRight(false);
_ButtonPressedState.setleftThumbstickUp(false);
_ButtonPressedState.setleftThumbstickDown(false);
}
// Iterate through the buttons to see if Left thumbstick, DPad, A and B are pressed.
var buttons = gamepad.buttons;
for (j = 0, len = buttons.length; j < len; j++) {
if (ProcessedButtons.indexOf(j) !== -1) {
if (buttons[j].pressed) {
switch (j) {
case _GAMEPAD_DPAD_UP_BUTTON_INDEX:
_ButtonPressedState.setdPadUp(true);
break;
case _GAMEPAD_DPAD_DOWN_BUTTON_INDEX:
_ButtonPressedState.setdPadDown(true);
break;
case _GAMEPAD_DPAD_LEFT_BUTTON_INDEX:
_ButtonPressedState.setdPadLeft(true);
break;
case _GAMEPAD_DPAD_RIGHT_BUTTON_INDEX:
_ButtonPressedState.setdPadRight(true);
break;
case _GAMEPAD_A_BUTTON_INDEX:
_ButtonPressedState.setgamepadA(true);
break;
case _GAMEPAD_B_BUTTON_INDEX:
_ButtonPressedState.setgamepadB(true);
break;
default:
// No-op
break;
}
} else {
switch (j) {
case _GAMEPAD_DPAD_UP_BUTTON_INDEX:
if (_ButtonPressedState.getdPadUp()) {
_ButtonPressedState.setdPadUp(false);
}
break;
case _GAMEPAD_DPAD_DOWN_BUTTON_INDEX:
if (_ButtonPressedState.getdPadDown()) {
_ButtonPressedState.setdPadDown(false);
}
break;
case _GAMEPAD_DPAD_LEFT_BUTTON_INDEX:
if (_ButtonPressedState.getdPadLeft()) {
_ButtonPressedState.setdPadLeft(false);
}
break;
case _GAMEPAD_DPAD_RIGHT_BUTTON_INDEX:
if (_ButtonPressedState.getdPadRight()) {
_ButtonPressedState.setdPadRight(false);
}
break;
case _GAMEPAD_A_BUTTON_INDEX:
if (_ButtonPressedState.getgamepadA()) {
_ButtonPressedState.setgamepadA(false);
}
break;
case _GAMEPAD_B_BUTTON_INDEX:
if (_ButtonPressedState.getgamepadB()) {
_ButtonPressedState.setgamepadB(false);
}
break;
default:
// No-op
break;
}
}
}
}
}
}
// Schedule the next one
requestAnimationFrame(runInputLoop);
}
runInputLoop();
// The gamepadInputEmulation is a string property that exists in JavaScript UWAs and in WebViews in UWAs.
// It won't exist in Win8.1 style apps or browsers.
if (window.navigator && typeof window.navigator.gamepadInputEmulation === "string") {
// We want the gamepad to provide gamepad VK keyboard events rather than moving a
// mouse like cursor. Set to "keyboard", the gamepad will provide such keyboard events
// and provide input to the DOM navigator.getGamepads API.
window.navigator.gamepadInputEmulation = "gamepad";
}
})();

View File

@ -997,7 +997,8 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
Name: t.Name || (item.Name + ' Trailer'), Name: t.Name || (item.Name + ' Trailer'),
Url: t.Url, Url: t.Url,
MediaType: 'Video', MediaType: 'Video',
Type: 'Trailer' Type: 'Trailer',
ServerId: apiClient.serverId()
}; };
}) })
}); });
@ -1212,7 +1213,19 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
return player.duration(); return player.duration();
} }
return getPlayerData(player).streamInfo.mediaSource.RunTimeTicks || ((player.duration() || 0) * 10000); var streamInfo = getPlayerData(player).streamInfo;
if (streamInfo && streamInfo.mediaSource && streamInfo.mediaSource.RunTimeTicks) {
return streamInfo.mediaSource.RunTimeTicks;
}
var playerDuration = player.duration();
if (playerDuration) {
playerDuration *= 10000;
}
return playerDuration;
}; };
function getCurrentTicks(player) { function getCurrentTicks(player) {

View File

@ -146,12 +146,20 @@
sendCommandByName('ToggleFullscreen'); sendCommandByName('ToggleFullscreen');
}; };
self.audioTracks = function () {
return [];
};
self.setAudioStreamIndex = function (index) { self.setAudioStreamIndex = function (index) {
sendCommandByName('SetAudioStreamIndex', { sendCommandByName('SetAudioStreamIndex', {
Index: index Index: index
}); });
}; };
self.subtitleTracks = function () {
return [];
};
self.setSubtitleStreamIndex = function (index) { self.setSubtitleStreamIndex = function (index) {
sendCommandByName('SetSubtitleStreamIndex', { sendCommandByName('SetSubtitleStreamIndex', {
Index: index Index: index

View File

@ -1,6 +1,6 @@
{ {
"name": "hls.js", "name": "hls.js",
"version": "0.6.15", "version": "0.6.16",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "Media Source Extension - HLS library, by/for Dailymotion", "description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js", "homepage": "https://github.com/dailymotion/hls.js",
@ -16,11 +16,11 @@
"test", "test",
"tests" "tests"
], ],
"_release": "0.6.15", "_release": "0.6.16",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v0.6.15", "tag": "v0.6.16",
"commit": "f0da89e4f6256457ebf87c6d5f9fd007d0ccca69" "commit": "61fbeb069d8ee6e37933085d576cd65c057c1b28"
}, },
"_source": "https://github.com/dailymotion/hls.js.git", "_source": "https://github.com/dailymotion/hls.js.git",
"_target": "^0.6.11", "_target": "^0.6.11",

View File

@ -1,6 +1,6 @@
{ {
"name": "hls.js", "name": "hls.js",
"version": "0.6.15", "version": "0.6.16",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "Media Source Extension - HLS library, by/for Dailymotion", "description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js", "homepage": "https://github.com/dailymotion/hls.js",

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "hls.js", "name": "hls.js",
"version": "0.6.15", "version": "0.6.16",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "Media Source Extension - HLS library, by/for Dailymotion", "description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js", "homepage": "https://github.com/dailymotion/hls.js",

View File

@ -161,6 +161,10 @@ define(['appStorage', 'browser'], function (appStorage, browser) {
features.push('physicalvolumecontrol'); features.push('physicalvolumecontrol');
} }
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
features.push('remotecontrol');
}
return features; return features;
}(); }();

View File

@ -32,7 +32,7 @@
} }
} }
function showPlayerSelection(button, enableHistory) { function showPlayerSelection(button) {
var currentPlayerInfo = playbackManager.getPlayerInfo(); var currentPlayerInfo = playbackManager.getPlayerInfo();
@ -80,7 +80,7 @@
// Unfortunately we can't allow the url to change or chromecast will throw a security error // Unfortunately we can't allow the url to change or chromecast will throw a security error
// Might be able to solve this in the future by moving the dialogs to hashbangs // Might be able to solve this in the future by moving the dialogs to hashbangs
if (!((enableHistory !== false && !browser.chrome) || AppInfo.isNativeApp)) { if (!((!browser.chrome) || AppInfo.isNativeApp)) {
menuOptions.enableHistory = false; menuOptions.enableHistory = false;
} }

View File

@ -766,8 +766,9 @@
context.querySelector('.typeTextForm').addEventListener('submit', onSendStringSubmit); context.querySelector('.typeTextForm').addEventListener('submit', onSendStringSubmit);
context.querySelector('.nowPlayingCastIcon').addEventListener('click', function () { context.querySelector('.nowPlayingCastIcon').addEventListener('click', function () {
var btn = this;
require(['playerSelectionMenu'], function (playerSelectionMenu) { require(['playerSelectionMenu'], function (playerSelectionMenu) {
playerSelectionMenu.show(); playerSelectionMenu.show(btn);
}); });
}); });

View File

@ -1,4 +1,4 @@
define(['datetime', 'userdataButtons', 'itemHelper', 'events', 'browser', 'imageLoader', 'playbackManager', 'nowPlayingHelper', 'apphost', 'dom', 'paper-icon-button-light'], function (datetime, userdataButtons, itemHelper, events, browser, imageLoader, playbackManager, nowPlayingHelper, appHost, dom) { define(['datetime', 'userdataButtons', 'itemHelper', 'events', 'browser', 'imageLoader', 'playbackManager', 'nowPlayingHelper', 'apphost', 'dom', 'connectionManager', 'paper-icon-button-light'], function (datetime, userdataButtons, itemHelper, events, browser, imageLoader, playbackManager, nowPlayingHelper, appHost, dom, connectionManager) {
'use strict'; 'use strict';
var currentPlayer; var currentPlayer;
@ -504,6 +504,66 @@
return html; return html;
} }
function seriesImageUrl(item, options) {
if (item.Type !== 'Episode') {
return null;
}
options = options || {};
options.type = options.type || "Primary";
if (options.type === 'Primary') {
if (item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
}
}
if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
}
if (item.ParentThumbImageTag) {
options.tag = item.ParentThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
}
}
return null;
}
function imageUrl(item, options) {
options = options || {};
options.type = options.type || "Primary";
if (item.ImageTags && item.ImageTags[options.type]) {
options.tag = item.ImageTags[options.type];
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.Id, options);
}
if (options.type === 'Primary') {
if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
}
}
return null;
}
var currentImgUrl; var currentImgUrl;
function updateNowPlayingInfo(state) { function updateNowPlayingInfo(state) {
@ -517,46 +577,14 @@
}).join(''); }).join('');
var url;
var imgHeight = 70; var imgHeight = 70;
var nowPlayingItem = state.NowPlayingItem; var nowPlayingItem = state.NowPlayingItem;
if (nowPlayingItem.PrimaryImageTag) { var url = seriesImageUrl(nowPlayingItem, {
height: imgHeight
url = ApiClient.getScaledImageUrl(nowPlayingItem.PrimaryImageItemId, { }) || imageUrl(nowPlayingItem, {
type: "Primary", height: imgHeight
height: imgHeight, });
tag: nowPlayingItem.PrimaryImageTag
});
}
else if (nowPlayingItem.BackdropImageTag) {
url = ApiClient.getScaledImageUrl(nowPlayingItem.BackdropItemId, {
type: "Backdrop",
height: imgHeight,
tag: nowPlayingItem.BackdropImageTag,
index: 0
});
} else if (nowPlayingItem.ThumbImageTag) {
url = ApiClient.getScaledImageUrl(nowPlayingItem.ThumbImageItemId, {
type: "Thumb",
height: imgHeight,
tag: nowPlayingItem.ThumbImageTag
});
}
else if (nowPlayingItem.Type == "TvChannel" || nowPlayingItem.Type == "Recording") {
url = "css/images/items/detail/tv.png";
}
else if (nowPlayingItem.MediaType == "Audio") {
url = "css/images/items/detail/audio.png";
}
else {
url = "css/images/items/detail/video.png";
}
if (url == currentImgUrl) { if (url == currentImgUrl) {
return; return;

View File

@ -1521,6 +1521,9 @@ var AppInfo = {};
Dashboard.navigate('mypreferencesmenu.html'); Dashboard.navigate('mypreferencesmenu.html');
}; };
embyRouter.setTitle = function () {
};
function showItem(item, serverId, options) { function showItem(item, serverId, options) {
if (typeof (item) === 'string') { if (typeof (item) === 'string') {
require(['connectionManager'], function (connectionManager) { require(['connectionManager'], function (connectionManager) {
@ -2629,6 +2632,24 @@ var AppInfo = {};
}); });
} }
function enableNativeGamepadKeyMapping() {
// On Windows UWP, this will tell the platform to make the gamepad emit normal keyboard events
if (window.navigator && typeof window.navigator.gamepadInputEmulation === "string") {
// We want the gamepad to provide gamepad VK keyboard events rather than moving a
// mouse like cursor. Set to "keyboard", the gamepad will provide such keyboard events
// and provide input to the DOM navigator.getGamepads API.
window.navigator.gamepadInputEmulation = "keyboard";
return true;
}
return false;
}
function isGamepadSupported() {
return 'ongamepadconnected' in window || navigator.getGamepads || navigator.webkitGetGamepads;
}
function onAppReady() { function onAppReady() {
console.log('Begin onAppReady'); console.log('Begin onAppReady');
@ -2676,6 +2697,10 @@ var AppInfo = {};
var postInitDependencies = []; var postInitDependencies = [];
if (!enableNativeGamepadKeyMapping() && isGamepadSupported()) {
postInitDependencies.push('bower_components/emby-webcomponents/input/gamepadtokey');
}
postInitDependencies.push('bower_components/emby-webcomponents/thememediaplayer'); postInitDependencies.push('bower_components/emby-webcomponents/thememediaplayer');
postInitDependencies.push('css!css/chromecast.css'); postInitDependencies.push('css!css/chromecast.css');
postInitDependencies.push('scripts/autobackdrops'); postInitDependencies.push('scripts/autobackdrops');

View File

@ -410,8 +410,27 @@
releaseCurrentPlayer(); releaseCurrentPlayer();
}); });
if (appHost.supports('remotecontrol')) {
view.querySelector('.btnCast').classList.remove('hide');
}
view.querySelector('.btnCast').addEventListener('click', function() {
var btn = this;
require(['playerSelectionMenu'], function (playerSelectionMenu) {
playerSelectionMenu.show(btn);
});
});
function onPlayerChange() { function onPlayerChange() {
bindToPlayer(playbackManager.getCurrentPlayer());
var currentPlayer = playbackManager.getCurrentPlayer();
if (currentPlayer && !currentPlayer.isLocalPlayer) {
view.querySelector('.btnCast i').innerHTML = '&#xE308;';
} else {
view.querySelector('.btnCast i').innerHTML = '&#xE307;';
}
bindToPlayer(currentPlayer);
} }
function onStateChanged(event, state) { function onStateChanged(event, state) {
@ -719,9 +738,7 @@
var player = currentPlayer; var player = currentPlayer;
var audioTracks = lastPlayerState.MediaSource.MediaStreams.filter(function (s) { var audioTracks = playbackManager.audioTracks(player);
return s.Type === 'Audio';
});
var currentIndex = playbackManager.getAudioStreamIndex(player); var currentIndex = playbackManager.getAudioStreamIndex(player);
@ -760,9 +777,7 @@
var player = currentPlayer; var player = currentPlayer;
var streams = lastPlayerState.MediaSource.MediaStreams.filter(function (s) { var streams = playbackManager.subtitleTracks(player);
return s.Type === 'Subtitle';
});
var currentIndex = playbackManager.getSubtitleStreamIndex(player); var currentIndex = playbackManager.getSubtitleStreamIndex(player);
if (currentIndex == null) { if (currentIndex == null) {

View File

@ -204,6 +204,9 @@
<button is="paper-icon-button-light" class="btnSubtitles autoSize"> <button is="paper-icon-button-light" class="btnSubtitles autoSize">
<i class="xlargePaperIconButton md-icon">&#xE01C;</i> <i class="xlargePaperIconButton md-icon">&#xE01C;</i>
</button> </button>
<button is="paper-icon-button-light" class="btnCast hide autoSize">
<i class="xlargePaperIconButton md-icon">&#xE307;</i>
</button>
<div class="osdTimeText"><span class="osdPositionText"></span><span class="osdDurationText"></span><span class="endsAtText"></span></div> <div class="osdTimeText"><span class="osdPositionText"></span><span class="osdDurationText"></span><span class="endsAtText"></span></div>