diff --git a/ApiClient.js b/ApiClient.js
index 2442141e6c..572cb0cf24 100644
--- a/ApiClient.js
+++ b/ApiClient.js
@@ -2589,7 +2589,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
-
/**
* Reports a user has stopped playing an item
* @param {String} userId
@@ -2629,6 +2628,42 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
url: url
});
};
+
+ self.sendBrowseCommand = function (sessionId, options) {
+
+ if (!sessionId) {
+ throw new Error("null sessionId");
+ }
+
+ if (!options) {
+ throw new Error("null options");
+ }
+
+ var url = self.getUrl("Sessions/" + sessionId + "/Viewing", options);
+
+ return self.ajax({
+ type: "POST",
+ url: url
+ });
+ };
+
+ self.sendPlayCommand = function (sessionId, options) {
+
+ if (!sessionId) {
+ throw new Error("null sessionId");
+ }
+
+ if (!options) {
+ throw new Error("null options");
+ }
+
+ var url = self.getUrl("Sessions/" + sessionId + "/Playing", options);
+
+ return self.ajax({
+ type: "POST",
+ url: url
+ });
+ };
}
}(jQuery, navigator, window.JSON, window.WebSocket, setTimeout);
diff --git a/dashboard-ui/itembynamedetails.html b/dashboard-ui/itembynamedetails.html
index e175133f74..df1595f2e8 100644
--- a/dashboard-ui/itembynamedetails.html
+++ b/dashboard-ui/itembynamedetails.html
@@ -127,6 +127,17 @@
+
diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html
index cffa3b4c9d..88162550da 100644
--- a/dashboard-ui/itemdetails.html
+++ b/dashboard-ui/itemdetails.html
@@ -127,7 +127,7 @@
-
+
diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js
index 8ca073a715..2eb5c93977 100644
--- a/dashboard-ui/scripts/itembynamedetailpage.js
+++ b/dashboard-ui/scripts/itembynamedetailpage.js
@@ -464,7 +464,16 @@
});
}
- $(document).on('pageshow', "#itemByNameDetailPage", function () {
+ $(document).on('pageinit', "#itemByNameDetailPage", function () {
+
+ var page = this;
+
+ $('#btnRemote', page).on('click', function () {
+
+ RemoteControl.showMenu(page, currentItem);
+ });
+
+ }).on('pageshow', "#itemByNameDetailPage", function () {
var page = this;
diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js
index 4fcf09f81d..23e75a223d 100644
--- a/dashboard-ui/scripts/mediaplayer.js
+++ b/dashboard-ui/scripts/mediaplayer.js
@@ -511,6 +511,12 @@
level: 3
}));
+ var ogvVideoUrl = ApiClient.getUrl('Videos/' + item.Id + '/stream.ogv', $.extend({}, baseParams, {
+ videoCodec: 'theora',
+ audioCodec: 'Vorbis'
+ }));
+
+
var html = '';
// HLS must be at the top for safari
@@ -518,15 +524,16 @@
// Can't autoplay in these browsers so we need to use the full controls
if ($.browser.msie || $.browser.android || $.browser.iphone || $.browser.ipad) {
- html += '';
+
+ $(document.body).append(html);
+
+ var popup = $('#remoteControlFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () {
+
+ $(this).off("popupafterclose").remove();
+ });
+
+ $('#sendToForm', popup).on('submit', function () {
+
+ var checkboxes = $('.chkClient', popup);
+
+ if (!checkboxes.length) {
+ $('#remoteControlFlyout').popup("close");
+ return false;
+ }
+
+ checkboxes = $('.chkClient:checked', popup);
+
+ if (!checkboxes.length) {
+ Dashboard.alert('Please select a device to control.');
+ return false;
+ }
+
+ var sessionIds = [];
+
+ checkboxes.parents('.trSession').each(function () {
+
+ sessionIds.push(this.getAttribute('data-sessionid'));
+
+ });
+
+ var command = $('#selectCommand', popup).val();
+
+ var promise;
+
+ if (command == "Browse") {
+ promise = ApiClient.sendBrowseCommand(sessionIds[0], {
+
+ ItemId: item.Id,
+ ItemName: item.Name,
+ ItemType: item.Type,
+ Context: context
+
+ });
+ }
+ else if (command == "Play") {
+ promise = ApiClient.sendPlayCommand(sessionIds[0], {
+
+ ItemIds: [item.Id].join(','),
+ PlayCommand: 'PlayNow'
+
+ });
+ }
+
+ promise.done(function () {
+
+ $('#remoteControlFlyout').popup("close");
+ });
+
+ return false;
+ });
+
+ var elem = $('.sessionsPopupContent');
+
+ $.when(sessionsPromise, usersPromise).done(function (response1, response2) {
+
+ var deviceId = ApiClient.deviceId();
+
+ var sessions = response1[0].filter(function (s) {
+ return s.DeviceId != deviceId;
+ });
+
+ renderSessions(sessions, response2[0], elem);
+
+ });
+ }
+
+ function renderSessions(sessions, users, elem) {
+
+ if (!sessions.length) {
+ elem.html('
There are currently no available media browser sessions to control.
');
+ $('#remoteControlFlyout').popup("reposition", {});
+ return;
+ }
+
+ var html = '';
+
+ html += '
';
+ html += '';
+ html += '';
+ html += '
';
+
+ html += '
Send To Device
';
+
+ html += '
';
+
+ html += '
';
+
+ html += '';
+ html += ' | ';
+ html += 'Client | ';
+ html += 'Device | ';
+ html += 'User | ';
+ html += '
';
+
+ html += '';
+
+ for (var i = 0, length = sessions.length; i < length; i++) {
+
+ var session = sessions[i];
+
+ html += '';
+
+ html += ' | ';
+ html += '' + session.Client + ' | ';
+ html += '' + session.DeviceName + ' | ';
+
+ html += '';
+
+ var user = null;
+
+ if (session.UserId) {
+
+ user = users.filter(function (u) {
+ return u.Id == session.UserId;
+ })[0];
+
+ }
+
+ html += user ? user.Name : ' ';
+
+ html += ' | ';
+
+ html += '
';
+ }
+
+ html += '';
+
+ html += '
';
+
+ html += '
';
+ html += '
';
+
+ elem.html(html).trigger('create');
+
+ $('.checkboxCell', elem).html('
');
+
+ $('#remoteControlFlyout').popup("reposition", {});
+ }
+
function remoteControl() {
var self = this;
- self.showMenu = function (page, item) {
-
- $('#confirmFlyout').popup("close").remove();
-
- var html = '
';
-
- html += '
';
- html += '
Remote Control
';
- html += '';
-
- html += '
';
-
- html += '
test';
- html += '
';
-
- html += '
';
- html += '
';
-
- html += '
';
-
- html += '
';
-
- $(document.body).append(html);
-
- $('#remoteControlFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () {
-
- $(this).off("popupafterclose").remove();
- });
+ self.showMenu = function (page, item, context) {
+ showMenu(page, item, context, ApiClient.getSessions({ SupportsRemoteControl: true }), ApiClient.getUsers());
};
}
diff --git a/packages.config b/packages.config
index b575b4c458..8590d6e8ae 100644
--- a/packages.config
+++ b/packages.config
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file