Move query parameters to request body in SyncPlay

This commit is contained in:
Ionut Andrei Oanca 2020-11-28 14:24:01 +01:00
parent bbef2197dd
commit 308deaceba
3 changed files with 15 additions and 11 deletions

View File

@ -72,7 +72,7 @@ class Controller {
const sendPlayRequest = (items) => {
const queue = items.map(item => item.Id);
apiClient.requestSyncPlayPlay({
PlayingQueue: queue.join(','),
PlayingQueue: queue,
PlayingItemPosition: options.startIndex ? options.startIndex : 0,
StartPositionTicks: options.startPositionTicks ? options.startPositionTicks : 0
});
@ -135,7 +135,7 @@ class Controller {
Helper.translateItemsForPlayback(apiClient, options.items, options).then((items) => {
const itemIds = items.map(item => item.Id);
apiClient.requestSyncPlayQueue({
ItemIds: itemIds.join(','),
ItemIds: itemIds,
Mode: mode
});
});
@ -146,7 +146,7 @@ class Controller {
Helper.translateItemsForPlayback(apiClient, result.Items, options).then((items) => {
const itemIds = items.map(item => item.Id);
apiClient.requestSyncPlayQueue({
ItemIds: itemIds.join(','),
ItemIds: itemIds,
Mode: mode
});
});

View File

@ -129,14 +129,19 @@ class PlaybackCore {
const now = this.timeSyncCore.localDateToRemote(currentTime);
const playlistItemId = this.manager.getQueueCore().getCurrentPlaylistItemId();
const apiClient = this.manager.getApiClient();
apiClient.requestSyncPlayBuffering({
const options = {
When: now.toISOString(),
PositionTicks: currentPositionTicks,
IsPlaying: isPlaying,
PlaylistItemId: playlistItemId,
BufferingDone: !isBuffering
});
PlaylistItemId: playlistItemId
};
const apiClient = this.manager.getApiClient();
if (isBuffering) {
apiClient.requestSyncPlayBuffering(options);
} else {
apiClient.requestSyncPlayReady(options);
}
}
/**

View File

@ -176,12 +176,11 @@ class QueueCore {
const currentPositionTicks = Math.round(currentPosition * Helper.TicksPerMillisecond);
const isPlaying = playerWrapper.isPlaying();
apiClient.requestSyncPlayBuffering({
apiClient.requestSyncPlayReady({
When: now.toISOString(),
PositionTicks: currentPositionTicks,
IsPlaying: isPlaying,
PlaylistItemId: this.getCurrentPlaylistItemId(),
BufferingDone: true
PlaylistItemId: this.getCurrentPlaylistItemId()
});
}).catch((error) => {
console.error('Error while waiting for `playbackstart` event!', origin, error);