mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update connect
This commit is contained in:
parent
c7da2478bb
commit
f67f57726d
5 changed files with 75 additions and 50 deletions
|
@ -206,7 +206,21 @@
|
|||
}
|
||||
|
||||
.searchResultsContainer {
|
||||
padding: 2em;
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
@media all and (min-width: 800px) {
|
||||
.searchResultsContainer {
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-height: 800px) {
|
||||
.searchResultsContainer {
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.btnCloseSearch {
|
||||
|
|
|
@ -604,9 +604,6 @@
|
|||
|
||||
console.log('Will attempt to connect to Chromecast');
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
setTimeout(Dashboard.hideModalLoadingMsg, 3000);
|
||||
|
||||
if (device.isReady()) {
|
||||
console.log('Device is already ready, calling onDeviceReady');
|
||||
onDeviceReady(device);
|
||||
|
|
97
dashboard-ui/thirdparty/cordova/generaldevice.js
vendored
97
dashboard-ui/thirdparty/cordova/generaldevice.js
vendored
|
@ -1,6 +1,7 @@
|
|||
(function () {
|
||||
|
||||
var currentPairingDeviceId;
|
||||
var currentPairedDeviceId;
|
||||
var currentDevice;
|
||||
|
||||
var PlayerName = "ConnectSDK";
|
||||
|
@ -478,69 +479,41 @@
|
|||
return data;
|
||||
};
|
||||
|
||||
function onDisconnected(device) {
|
||||
function cleanupSession() {
|
||||
|
||||
if (currentDevice && device.getId() == currentDevice.getId()) {
|
||||
if (currentDevice != null) {
|
||||
currentDevice.off("ready");
|
||||
currentDevice.off("disconnect");
|
||||
|
||||
currentDevice.disconnect();
|
||||
}
|
||||
|
||||
currentPairedDeviceId = null;
|
||||
currentDevice = null;
|
||||
MediaController.removeActiveTarget(device.getId());
|
||||
}
|
||||
}
|
||||
|
||||
function onDeviceReady(device) {
|
||||
function onDeviceReady(device, deferred) {
|
||||
|
||||
if (currentPairingDeviceId != device.getId()) {
|
||||
console.log('device ready fired for a different device. ignoring.');
|
||||
return;
|
||||
}
|
||||
|
||||
currentDevice = device;
|
||||
MediaController.setActivePlayer(PlayerName, convertDeviceToTarget(device));
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
var boundHandlers = [];
|
||||
|
||||
self.tryPair = function (target) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
var manager = ConnectSDK.discoveryManager;
|
||||
|
||||
var device = manager.getDeviceList().filter(function (d) {
|
||||
var device = ConnectSDK.discoveryManager.getDeviceList().filter(function (d) {
|
||||
|
||||
return d.getId() == target.id;
|
||||
})[0];
|
||||
|
||||
if (device) {
|
||||
|
||||
var deviceId = device.getId();
|
||||
currentPairingDeviceId = deviceId;
|
||||
|
||||
console.log('Will attempt to connect to device');
|
||||
|
||||
if (device.isReady()) {
|
||||
console.log('Device is already ready, calling onDeviceReady');
|
||||
onDeviceReady(device);
|
||||
} else {
|
||||
|
||||
console.log('Binding device ready handler');
|
||||
|
||||
if (boundHandlers.indexOf(deviceId) == -1) {
|
||||
|
||||
boundHandlers.push(deviceId);
|
||||
device.on("ready", function () {
|
||||
console.log('device.ready fired');
|
||||
onDeviceReady(device);
|
||||
});
|
||||
device.on("disconnect", function () {
|
||||
console.log('device.disconnect fired');
|
||||
onDisconnected(device);
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Calling device.connect');
|
||||
device.connect();
|
||||
}
|
||||
//deferred.resolve();
|
||||
self.tryPairWithDevice(device, deferred);
|
||||
|
||||
} else {
|
||||
deferred.reject();
|
||||
|
@ -549,11 +522,47 @@
|
|||
return deferred.promise();
|
||||
};
|
||||
|
||||
self.tryPairWithDevice = function (device, deferred) {
|
||||
|
||||
var deviceId = device.getId();
|
||||
currentPairingDeviceId = deviceId;
|
||||
|
||||
console.log('Will attempt to connect to Connect device');
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
setTimeout(Dashboard.hideModalLoadingMsg, 3000);
|
||||
|
||||
if (device.isReady()) {
|
||||
console.log('Device is already ready, calling onDeviceReady');
|
||||
onDeviceReady(device, deferred);
|
||||
} else {
|
||||
|
||||
console.log('Binding device ready handler');
|
||||
|
||||
device.on("ready", function () {
|
||||
console.log('device.ready fired');
|
||||
onDeviceReady(device, deferred);
|
||||
});
|
||||
|
||||
device.on("disconnect", function () {
|
||||
device.off("ready");
|
||||
device.off("disconnect");
|
||||
});
|
||||
|
||||
console.log('Calling device.connect');
|
||||
device.connect();
|
||||
}
|
||||
};
|
||||
|
||||
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||
|
||||
if (currentDevice && newTarget.id != currentDevice.getId()) {
|
||||
MediaController.removeActiveTarget(currentDevice.getId());
|
||||
currentDevice = null;
|
||||
if (currentPairedDeviceId) {
|
||||
if (newTarget.id != currentPairedDeviceId) {
|
||||
if (currentDevice) {
|
||||
console.log('Disconnecting from connect device');
|
||||
cleanupSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
|
||||
function validateLiveTV(deferred) {
|
||||
|
||||
if (!isAndroid()) {
|
||||
deferred.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
validateFeature(getPremiumUnlockFeatureId(), deferred);
|
||||
}
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@
|
|||
items = shuffleArray(items);
|
||||
}
|
||||
|
||||
items = items.map(function(i) {
|
||||
items = items.map(function (i) {
|
||||
return i.Id;
|
||||
});
|
||||
|
||||
|
@ -437,7 +437,7 @@
|
|||
|
||||
$('.voiceInputText').html(text);
|
||||
|
||||
if (text) {
|
||||
if (text || AppInfo.isNativeApp) {
|
||||
$('.blockedMessage').hide();
|
||||
} else {
|
||||
$('.blockedMessage').show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue