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

Merge pull request #1534 from MrTimscampi/syncplay-better-api

Use new SyncPlay API client
This commit is contained in:
dkanada 2020-07-10 05:28:42 +09:00 committed by GitHub
commit c0d8b903c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View file

@ -37,7 +37,7 @@ function showNewJoinGroupSelection (button, user, apiClient) {
console.debug('No item is currently playing.'); console.debug('No item is currently playing.');
} }
apiClient.sendSyncPlayCommand('ListGroups').then(function (response) { apiClient.getSyncPlayGroups().then(function (response) {
response.json().then(function (groups) { response.json().then(function (groups) {
var menuItems = groups.map(function (group) { var menuItems = groups.map(function (group) {
return { return {
@ -83,9 +83,9 @@ function showNewJoinGroupSelection (button, user, apiClient) {
actionsheet.show(menuOptions).then(function (id) { actionsheet.show(menuOptions).then(function (id) {
if (id == 'new-group') { if (id == 'new-group') {
apiClient.sendSyncPlayCommand('NewGroup'); apiClient.createSyncPlayGroup();
} else { } else {
apiClient.sendSyncPlayCommand('JoinGroup', { apiClient.joinSyncPlayGroup({
GroupId: id, GroupId: id,
PlayingItemId: playingItemId PlayingItemId: playingItemId
}); });
@ -140,7 +140,7 @@ function showLeaveGroupSelection (button, user, apiClient) {
actionsheet.show(menuOptions).then(function (id) { actionsheet.show(menuOptions).then(function (id) {
if (id == 'leave-group') { if (id == 'leave-group') {
apiClient.sendSyncPlayCommand('LeaveGroup'); apiClient.leaveSyncPlayGroup();
} }
}).catch((error) => { }).catch((error) => {
console.error('SyncPlay: unexpected error showing group menu:', error); console.error('SyncPlay: unexpected error showing group menu:', error);

View file

@ -139,7 +139,7 @@ class SyncPlayManager {
return; return;
} }
apiClient.sendSyncPlayCommand('UpdatePing', { apiClient.sendSyncPlayPing({
Ping: ping Ping: ping
}); });
} }
@ -447,7 +447,7 @@ class SyncPlayManager {
if (!success) { if (!success) {
console.warning('Error reporting playback state to server. Joining group will fail.'); console.warning('Error reporting playback state to server. Joining group will fail.');
} }
apiClient.sendSyncPlayCommand('JoinGroup', { apiClient.joinSyncPlayGroup({
GroupId: groupId, GroupId: groupId,
PlayingItemId: playingItemId PlayingItemId: playingItemId
}); });
@ -658,7 +658,7 @@ class SyncPlayManager {
*/ */
playRequest (player) { playRequest (player) {
var apiClient = connectionManager.currentApiClient(); var apiClient = connectionManager.currentApiClient();
apiClient.sendSyncPlayCommand('PlayRequest'); apiClient.requestSyncPlayStart();
} }
/** /**
@ -666,7 +666,7 @@ class SyncPlayManager {
*/ */
pauseRequest (player) { pauseRequest (player) {
var apiClient = connectionManager.currentApiClient(); var apiClient = connectionManager.currentApiClient();
apiClient.sendSyncPlayCommand('PauseRequest'); apiClient.requestSyncPlayPause();
// Pause locally as well, to give the user some little control // Pause locally as well, to give the user some little control
playbackManager._localUnpause(player); playbackManager._localUnpause(player);
} }
@ -676,7 +676,7 @@ class SyncPlayManager {
*/ */
seekRequest (PositionTicks, player) { seekRequest (PositionTicks, player) {
var apiClient = connectionManager.currentApiClient(); var apiClient = connectionManager.currentApiClient();
apiClient.sendSyncPlayCommand('SeekRequest', { apiClient.requestSyncPlaySeek({
PositionTicks: PositionTicks PositionTicks: PositionTicks
}); });
} }

View file

@ -6309,9 +6309,9 @@ isurl@^1.0.0-alpha5:
is-object "^1.0.1" is-object "^1.0.1"
jellyfin-apiclient@^1.3.0: jellyfin-apiclient@^1.3.0:
version "1.3.1" version "1.4.0"
resolved "https://registry.yarnpkg.com/jellyfin-apiclient/-/jellyfin-apiclient-1.3.1.tgz#7ecaa986dbb6e36cce9d8f94dd66619419afa32d" resolved "https://registry.yarnpkg.com/jellyfin-apiclient/-/jellyfin-apiclient-1.4.0.tgz#d8fedc88cc177597290687be31e38de3cd0d035a"
integrity sha512-PQUKFDcQOy4hJ43Jc3Lm3571zONlTjr2qmr6pEVcfLZs7Lvwa4oUu/yonH6MMxpjZOvTbcirjer+XXgF2RwXyA== integrity sha512-v2lcSZwcbKh3YSrZkBwNM7tisxvUJHZawz0xpxIobEI6MHrQLo4oDdm1zHXN6Mku9uzbuBpbAV1tA6XJwVVTyA==
"jellyfin-noto@https://github.com/jellyfin/jellyfin-noto": "jellyfin-noto@https://github.com/jellyfin/jellyfin-noto":
version "1.0.3" version "1.0.3"