Add playlist-sync and group-wait to SyncPlay

This commit is contained in:
Ionut Andrei Oanca 2020-09-25 09:44:30 +02:00
parent 46a0382c0a
commit d8beb9909f
41 changed files with 3880 additions and 1125 deletions

View file

@ -0,0 +1,39 @@
/**
* Module that manages time syncing with server.
* @module components/syncPlay/core/timeSync/server
*/
import TimeSync from './timeSync';
/**
* Class that manages time syncing with server.
*/
class TimeSyncServer extends TimeSync {
constructor(syncPlayManager) {
super(syncPlayManager);
}
/**
* Makes a ping request to the server.
*/
requestPing() {
const apiClient = this.manager.getApiClient();
const requestSent = new Date();
let responseReceived;
return apiClient.getServerTime().then((response) => {
responseReceived = new Date();
return response.json();
}).then((data) => {
const requestReceived = new Date(data.RequestReceptionTime);
const responseSent = new Date(data.ResponseTransmissionTime);
return Promise.resolve({
requestSent: requestSent,
requestReceived: requestReceived,
responseSent: responseSent,
responseReceived: responseReceived
});
});
}
}
export default TimeSyncServer;