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 {
|
.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 {
|
.btnCloseSearch {
|
||||||
|
|
|
@ -604,9 +604,6 @@
|
||||||
|
|
||||||
console.log('Will attempt to connect to Chromecast');
|
console.log('Will attempt to connect to Chromecast');
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
|
||||||
setTimeout(Dashboard.hideModalLoadingMsg, 3000);
|
|
||||||
|
|
||||||
if (device.isReady()) {
|
if (device.isReady()) {
|
||||||
console.log('Device is already ready, calling onDeviceReady');
|
console.log('Device is already ready, calling onDeviceReady');
|
||||||
onDeviceReady(device);
|
onDeviceReady(device);
|
||||||
|
|
97
dashboard-ui/thirdparty/cordova/generaldevice.js
vendored
97
dashboard-ui/thirdparty/cordova/generaldevice.js
vendored
|
@ -1,6 +1,7 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
var currentPairingDeviceId;
|
var currentPairingDeviceId;
|
||||||
|
var currentPairedDeviceId;
|
||||||
var currentDevice;
|
var currentDevice;
|
||||||
|
|
||||||
var PlayerName = "ConnectSDK";
|
var PlayerName = "ConnectSDK";
|
||||||
|
@ -478,69 +479,41 @@
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
function onDisconnected(device) {
|
function cleanupSession() {
|
||||||
|
|
||||||
if (currentDevice && device.getId() == currentDevice.getId()) {
|
if (currentDevice != null) {
|
||||||
currentDevice = null;
|
currentDevice.off("ready");
|
||||||
MediaController.removeActiveTarget(device.getId());
|
currentDevice.off("disconnect");
|
||||||
|
|
||||||
|
currentDevice.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentPairedDeviceId = null;
|
||||||
|
currentDevice = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDeviceReady(device) {
|
function onDeviceReady(device, deferred) {
|
||||||
|
|
||||||
if (currentPairingDeviceId != device.getId()) {
|
if (currentPairingDeviceId != device.getId()) {
|
||||||
console.log('device ready fired for a different device. ignoring.');
|
console.log('device ready fired for a different device. ignoring.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentDevice = device;
|
deferred.resolve();
|
||||||
MediaController.setActivePlayer(PlayerName, convertDeviceToTarget(device));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var boundHandlers = [];
|
|
||||||
|
|
||||||
self.tryPair = function (target) {
|
self.tryPair = function (target) {
|
||||||
|
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
|
|
||||||
var manager = ConnectSDK.discoveryManager;
|
var device = ConnectSDK.discoveryManager.getDeviceList().filter(function (d) {
|
||||||
|
|
||||||
var device = manager.getDeviceList().filter(function (d) {
|
|
||||||
|
|
||||||
return d.getId() == target.id;
|
return d.getId() == target.id;
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
|
|
||||||
var deviceId = device.getId();
|
self.tryPairWithDevice(device, deferred);
|
||||||
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();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
|
@ -549,11 +522,47 @@
|
||||||
return deferred.promise();
|
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) {
|
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||||
|
|
||||||
if (currentDevice && newTarget.id != currentDevice.getId()) {
|
if (currentPairedDeviceId) {
|
||||||
MediaController.removeActiveTarget(currentDevice.getId());
|
if (newTarget.id != currentPairedDeviceId) {
|
||||||
currentDevice = null;
|
if (currentDevice) {
|
||||||
|
console.log('Disconnecting from connect device');
|
||||||
|
cleanupSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
function validateLiveTV(deferred) {
|
function validateLiveTV(deferred) {
|
||||||
|
|
||||||
|
if (!isAndroid()) {
|
||||||
|
deferred.resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
validateFeature(getPremiumUnlockFeatureId(), deferred);
|
validateFeature(getPremiumUnlockFeatureId(), deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@
|
||||||
items = shuffleArray(items);
|
items = shuffleArray(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
items = items.map(function(i) {
|
items = items.map(function (i) {
|
||||||
return i.Id;
|
return i.Id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@
|
||||||
|
|
||||||
$('.voiceInputText').html(text);
|
$('.voiceInputText').html(text);
|
||||||
|
|
||||||
if (text) {
|
if (text || AppInfo.isNativeApp) {
|
||||||
$('.blockedMessage').hide();
|
$('.blockedMessage').hide();
|
||||||
} else {
|
} else {
|
||||||
$('.blockedMessage').show();
|
$('.blockedMessage').show();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue