@microsoft/live-share-media 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cjs/IMediaPlayer.d.ts +21 -0
- package/bin/cjs/IMediaPlayer.d.ts.map +1 -0
- package/bin/cjs/IMediaPlayer.js +7 -0
- package/bin/cjs/IMediaPlayer.js.map +1 -0
- package/bin/cjs/LiveMediaSession.d.ts +97 -0
- package/bin/cjs/LiveMediaSession.d.ts.map +1 -0
- package/bin/cjs/LiveMediaSession.js +261 -0
- package/bin/cjs/LiveMediaSession.js.map +1 -0
- package/bin/cjs/LiveMediaSessionCoordinator.d.ts +304 -0
- package/bin/cjs/LiveMediaSessionCoordinator.d.ts.map +1 -0
- package/bin/cjs/LiveMediaSessionCoordinator.js +560 -0
- package/bin/cjs/LiveMediaSessionCoordinator.js.map +1 -0
- package/bin/cjs/LiveMediaSessionCoordinatorSuspension.d.ts +20 -0
- package/bin/cjs/LiveMediaSessionCoordinatorSuspension.d.ts.map +1 -0
- package/bin/cjs/LiveMediaSessionCoordinatorSuspension.js +28 -0
- package/bin/cjs/LiveMediaSessionCoordinatorSuspension.js.map +1 -0
- package/bin/cjs/MediaPlayerSynchronizer.d.ts +204 -0
- package/bin/cjs/MediaPlayerSynchronizer.d.ts.map +1 -0
- package/bin/cjs/MediaPlayerSynchronizer.js +574 -0
- package/bin/cjs/MediaPlayerSynchronizer.js.map +1 -0
- package/bin/cjs/MediaSessionActionThrottler.d.ts +12 -0
- package/bin/cjs/MediaSessionActionThrottler.d.ts.map +1 -0
- package/bin/cjs/MediaSessionActionThrottler.js +14 -0
- package/bin/cjs/MediaSessionActionThrottler.js.map +1 -0
- package/bin/cjs/MediaSessionExtensions.d.ts +177 -0
- package/bin/cjs/MediaSessionExtensions.d.ts.map +1 -0
- package/bin/cjs/MediaSessionExtensions.js +26 -0
- package/bin/cjs/MediaSessionExtensions.js.map +1 -0
- package/bin/cjs/RepeatedActionThrottler.d.ts +20 -0
- package/bin/cjs/RepeatedActionThrottler.d.ts.map +1 -0
- package/bin/cjs/RepeatedActionThrottler.js +63 -0
- package/bin/cjs/RepeatedActionThrottler.js.map +1 -0
- package/bin/cjs/VolumeManager.d.ts +84 -0
- package/bin/cjs/VolumeManager.d.ts.map +1 -0
- package/bin/cjs/VolumeManager.js +175 -0
- package/bin/cjs/VolumeManager.js.map +1 -0
- package/bin/cjs/index.d.ts +14 -0
- package/bin/cjs/index.d.ts.map +1 -0
- package/bin/cjs/index.js +30 -0
- package/bin/cjs/index.js.map +1 -0
- package/bin/cjs/internals/GroupCoordinatorState.d.ts +110 -0
- package/bin/cjs/internals/GroupCoordinatorState.d.ts.map +1 -0
- package/bin/cjs/internals/GroupCoordinatorState.js +516 -0
- package/bin/cjs/internals/GroupCoordinatorState.js.map +1 -0
- package/bin/cjs/internals/GroupPlaybackPosition.d.ts +71 -0
- package/bin/cjs/internals/GroupPlaybackPosition.d.ts.map +1 -0
- package/bin/cjs/internals/GroupPlaybackPosition.js +170 -0
- package/bin/cjs/internals/GroupPlaybackPosition.js.map +1 -0
- package/bin/cjs/internals/GroupPlaybackRate.d.ts +38 -0
- package/bin/cjs/internals/GroupPlaybackRate.d.ts.map +1 -0
- package/bin/cjs/internals/GroupPlaybackRate.js +59 -0
- package/bin/cjs/internals/GroupPlaybackRate.js.map +1 -0
- package/bin/cjs/internals/GroupPlaybackTrack.d.ts +45 -0
- package/bin/cjs/internals/GroupPlaybackTrack.d.ts.map +1 -0
- package/bin/cjs/internals/GroupPlaybackTrack.js +122 -0
- package/bin/cjs/internals/GroupPlaybackTrack.js.map +1 -0
- package/bin/cjs/internals/GroupPlaybackTrackData.d.ts +40 -0
- package/bin/cjs/internals/GroupPlaybackTrackData.d.ts.map +1 -0
- package/bin/cjs/internals/GroupPlaybackTrackData.js +70 -0
- package/bin/cjs/internals/GroupPlaybackTrackData.js.map +1 -0
- package/bin/cjs/internals/GroupTransportState.d.ts +52 -0
- package/bin/cjs/internals/GroupTransportState.d.ts.map +1 -0
- package/bin/cjs/internals/GroupTransportState.js +120 -0
- package/bin/cjs/internals/GroupTransportState.js.map +1 -0
- package/bin/cjs/internals/PriorityTimeInterval.d.ts +33 -0
- package/bin/cjs/internals/PriorityTimeInterval.d.ts.map +1 -0
- package/bin/cjs/internals/PriorityTimeInterval.js +45 -0
- package/bin/cjs/internals/PriorityTimeInterval.js.map +1 -0
- package/bin/cjs/internals/consts.d.ts +83 -0
- package/bin/cjs/internals/consts.d.ts.map +1 -0
- package/bin/cjs/internals/consts.js +92 -0
- package/bin/cjs/internals/consts.js.map +1 -0
- package/bin/cjs/internals/errors.d.ts +17 -0
- package/bin/cjs/internals/errors.d.ts.map +1 -0
- package/bin/cjs/internals/errors.js +34 -0
- package/bin/cjs/internals/errors.js.map +1 -0
- package/bin/cjs/internals/interfaces.d.ts +23 -0
- package/bin/cjs/internals/interfaces.d.ts.map +1 -0
- package/bin/cjs/internals/interfaces.js +3 -0
- package/bin/cjs/internals/interfaces.js.map +1 -0
- package/bin/cjs/package.json +1 -0
- package/bin/esm/IMediaPlayer.d.ts +21 -0
- package/bin/esm/IMediaPlayer.d.ts.map +1 -0
- package/bin/esm/IMediaPlayer.js +6 -0
- package/bin/esm/IMediaPlayer.js.map +1 -0
- package/bin/esm/LiveMediaSession.d.ts +97 -0
- package/bin/esm/LiveMediaSession.d.ts.map +1 -0
- package/bin/esm/LiveMediaSession.js +257 -0
- package/bin/esm/LiveMediaSession.js.map +1 -0
- package/bin/esm/LiveMediaSessionCoordinator.d.ts +304 -0
- package/bin/esm/LiveMediaSessionCoordinator.d.ts.map +1 -0
- package/bin/esm/LiveMediaSessionCoordinator.js +556 -0
- package/bin/esm/LiveMediaSessionCoordinator.js.map +1 -0
- package/bin/esm/LiveMediaSessionCoordinatorSuspension.d.ts +20 -0
- package/bin/esm/LiveMediaSessionCoordinatorSuspension.d.ts.map +1 -0
- package/bin/esm/LiveMediaSessionCoordinatorSuspension.js +24 -0
- package/bin/esm/LiveMediaSessionCoordinatorSuspension.js.map +1 -0
- package/bin/esm/MediaPlayerSynchronizer.d.ts +204 -0
- package/bin/esm/MediaPlayerSynchronizer.d.ts.map +1 -0
- package/bin/esm/MediaPlayerSynchronizer.js +570 -0
- package/bin/esm/MediaPlayerSynchronizer.js.map +1 -0
- package/bin/esm/MediaSessionActionThrottler.d.ts +12 -0
- package/bin/esm/MediaSessionActionThrottler.d.ts.map +1 -0
- package/bin/esm/MediaSessionActionThrottler.js +10 -0
- package/bin/esm/MediaSessionActionThrottler.js.map +1 -0
- package/bin/esm/MediaSessionExtensions.d.ts +177 -0
- package/bin/esm/MediaSessionExtensions.d.ts.map +1 -0
- package/bin/esm/MediaSessionExtensions.js +23 -0
- package/bin/esm/MediaSessionExtensions.js.map +1 -0
- package/bin/esm/RepeatedActionThrottler.d.ts +20 -0
- package/bin/esm/RepeatedActionThrottler.d.ts.map +1 -0
- package/bin/esm/RepeatedActionThrottler.js +59 -0
- package/bin/esm/RepeatedActionThrottler.js.map +1 -0
- package/bin/esm/VolumeManager.d.ts +84 -0
- package/bin/esm/VolumeManager.d.ts.map +1 -0
- package/bin/esm/VolumeManager.js +171 -0
- package/bin/esm/VolumeManager.js.map +1 -0
- package/bin/esm/index.d.ts +14 -0
- package/bin/esm/index.d.ts.map +1 -0
- package/bin/esm/index.js +14 -0
- package/bin/esm/index.js.map +1 -0
- package/bin/esm/internals/GroupCoordinatorState.d.ts +110 -0
- package/bin/esm/internals/GroupCoordinatorState.d.ts.map +1 -0
- package/bin/esm/internals/GroupCoordinatorState.js +512 -0
- package/bin/esm/internals/GroupCoordinatorState.js.map +1 -0
- package/bin/esm/internals/GroupPlaybackPosition.d.ts +71 -0
- package/bin/esm/internals/GroupPlaybackPosition.d.ts.map +1 -0
- package/bin/esm/internals/GroupPlaybackPosition.js +166 -0
- package/bin/esm/internals/GroupPlaybackPosition.js.map +1 -0
- package/bin/esm/internals/GroupPlaybackRate.d.ts +38 -0
- package/bin/esm/internals/GroupPlaybackRate.d.ts.map +1 -0
- package/bin/esm/internals/GroupPlaybackRate.js +55 -0
- package/bin/esm/internals/GroupPlaybackRate.js.map +1 -0
- package/bin/esm/internals/GroupPlaybackTrack.d.ts +45 -0
- package/bin/esm/internals/GroupPlaybackTrack.d.ts.map +1 -0
- package/bin/esm/internals/GroupPlaybackTrack.js +118 -0
- package/bin/esm/internals/GroupPlaybackTrack.js.map +1 -0
- package/bin/esm/internals/GroupPlaybackTrackData.d.ts +40 -0
- package/bin/esm/internals/GroupPlaybackTrackData.d.ts.map +1 -0
- package/bin/esm/internals/GroupPlaybackTrackData.js +66 -0
- package/bin/esm/internals/GroupPlaybackTrackData.js.map +1 -0
- package/bin/esm/internals/GroupTransportState.d.ts +52 -0
- package/bin/esm/internals/GroupTransportState.d.ts.map +1 -0
- package/bin/esm/internals/GroupTransportState.js +116 -0
- package/bin/esm/internals/GroupTransportState.js.map +1 -0
- package/bin/esm/internals/PriorityTimeInterval.d.ts +33 -0
- package/bin/esm/internals/PriorityTimeInterval.d.ts.map +1 -0
- package/bin/esm/internals/PriorityTimeInterval.js +41 -0
- package/bin/esm/internals/PriorityTimeInterval.js.map +1 -0
- package/bin/esm/internals/consts.d.ts +83 -0
- package/bin/esm/internals/consts.d.ts.map +1 -0
- package/bin/esm/internals/consts.js +89 -0
- package/bin/esm/internals/consts.js.map +1 -0
- package/bin/esm/internals/errors.d.ts +17 -0
- package/bin/esm/internals/errors.d.ts.map +1 -0
- package/bin/esm/internals/errors.js +29 -0
- package/bin/esm/internals/errors.js.map +1 -0
- package/bin/esm/internals/interfaces.d.ts +23 -0
- package/bin/esm/internals/interfaces.d.ts.map +1 -0
- package/bin/esm/internals/interfaces.js +2 -0
- package/bin/esm/internals/interfaces.js.map +1 -0
- package/bin/test/IMediaPlayer.d.ts +21 -0
- package/bin/test/IMediaPlayer.d.ts.map +1 -0
- package/bin/test/IMediaPlayer.js +7 -0
- package/bin/test/IMediaPlayer.js.map +1 -0
- package/bin/test/LiveMediaSession.d.ts +97 -0
- package/bin/test/LiveMediaSession.d.ts.map +1 -0
- package/bin/test/LiveMediaSession.js +261 -0
- package/bin/test/LiveMediaSession.js.map +1 -0
- package/bin/test/LiveMediaSessionCoordinator.d.ts +304 -0
- package/bin/test/LiveMediaSessionCoordinator.d.ts.map +1 -0
- package/bin/test/LiveMediaSessionCoordinator.js +560 -0
- package/bin/test/LiveMediaSessionCoordinator.js.map +1 -0
- package/bin/test/LiveMediaSessionCoordinatorSuspension.d.ts +20 -0
- package/bin/test/LiveMediaSessionCoordinatorSuspension.d.ts.map +1 -0
- package/bin/test/LiveMediaSessionCoordinatorSuspension.js +28 -0
- package/bin/test/LiveMediaSessionCoordinatorSuspension.js.map +1 -0
- package/bin/test/MediaPlayerSynchronizer.d.ts +204 -0
- package/bin/test/MediaPlayerSynchronizer.d.ts.map +1 -0
- package/bin/test/MediaPlayerSynchronizer.js +574 -0
- package/bin/test/MediaPlayerSynchronizer.js.map +1 -0
- package/bin/test/MediaSessionActionThrottler.d.ts +12 -0
- package/bin/test/MediaSessionActionThrottler.d.ts.map +1 -0
- package/bin/test/MediaSessionActionThrottler.js +14 -0
- package/bin/test/MediaSessionActionThrottler.js.map +1 -0
- package/bin/test/MediaSessionExtensions.d.ts +177 -0
- package/bin/test/MediaSessionExtensions.d.ts.map +1 -0
- package/bin/test/MediaSessionExtensions.js +26 -0
- package/bin/test/MediaSessionExtensions.js.map +1 -0
- package/bin/test/RepeatedActionThrottler.d.ts +20 -0
- package/bin/test/RepeatedActionThrottler.d.ts.map +1 -0
- package/bin/test/RepeatedActionThrottler.js +63 -0
- package/bin/test/RepeatedActionThrottler.js.map +1 -0
- package/bin/test/VolumeManager.d.ts +84 -0
- package/bin/test/VolumeManager.d.ts.map +1 -0
- package/bin/test/VolumeManager.js +175 -0
- package/bin/test/VolumeManager.js.map +1 -0
- package/bin/test/index.d.ts +14 -0
- package/bin/test/index.d.ts.map +1 -0
- package/bin/test/index.js +30 -0
- package/bin/test/index.js.map +1 -0
- package/bin/test/internals/GroupCoordinatorState.d.ts +110 -0
- package/bin/test/internals/GroupCoordinatorState.d.ts.map +1 -0
- package/bin/test/internals/GroupCoordinatorState.js +516 -0
- package/bin/test/internals/GroupCoordinatorState.js.map +1 -0
- package/bin/test/internals/GroupPlaybackPosition.d.ts +71 -0
- package/bin/test/internals/GroupPlaybackPosition.d.ts.map +1 -0
- package/bin/test/internals/GroupPlaybackPosition.js +170 -0
- package/bin/test/internals/GroupPlaybackPosition.js.map +1 -0
- package/bin/test/internals/GroupPlaybackRate.d.ts +38 -0
- package/bin/test/internals/GroupPlaybackRate.d.ts.map +1 -0
- package/bin/test/internals/GroupPlaybackRate.js +59 -0
- package/bin/test/internals/GroupPlaybackRate.js.map +1 -0
- package/bin/test/internals/GroupPlaybackTrack.d.ts +45 -0
- package/bin/test/internals/GroupPlaybackTrack.d.ts.map +1 -0
- package/bin/test/internals/GroupPlaybackTrack.js +122 -0
- package/bin/test/internals/GroupPlaybackTrack.js.map +1 -0
- package/bin/test/internals/GroupPlaybackTrackData.d.ts +40 -0
- package/bin/test/internals/GroupPlaybackTrackData.d.ts.map +1 -0
- package/bin/test/internals/GroupPlaybackTrackData.js +70 -0
- package/bin/test/internals/GroupPlaybackTrackData.js.map +1 -0
- package/bin/test/internals/GroupTransportState.d.ts +52 -0
- package/bin/test/internals/GroupTransportState.d.ts.map +1 -0
- package/bin/test/internals/GroupTransportState.js +120 -0
- package/bin/test/internals/GroupTransportState.js.map +1 -0
- package/bin/test/internals/PriorityTimeInterval.d.ts +33 -0
- package/bin/test/internals/PriorityTimeInterval.d.ts.map +1 -0
- package/bin/test/internals/PriorityTimeInterval.js +45 -0
- package/bin/test/internals/PriorityTimeInterval.js.map +1 -0
- package/bin/test/internals/consts.d.ts +83 -0
- package/bin/test/internals/consts.d.ts.map +1 -0
- package/bin/test/internals/consts.js +92 -0
- package/bin/test/internals/consts.js.map +1 -0
- package/bin/test/internals/errors.d.ts +17 -0
- package/bin/test/internals/errors.d.ts.map +1 -0
- package/bin/test/internals/errors.js +34 -0
- package/bin/test/internals/errors.js.map +1 -0
- package/bin/test/internals/interfaces.d.ts +23 -0
- package/bin/test/internals/interfaces.d.ts.map +1 -0
- package/bin/test/internals/interfaces.js +3 -0
- package/bin/test/internals/interfaces.js.map +1 -0
- package/bin/test/package.json +1 -0
- package/bin/test/test/GroupPlaybackPosition.spec.d.ts +6 -0
- package/bin/test/test/GroupPlaybackPosition.spec.d.ts.map +1 -0
- package/bin/test/test/GroupPlaybackPosition.spec.js +315 -0
- package/bin/test/test/GroupPlaybackPosition.spec.js.map +1 -0
- package/bin/test/test/GroupPlaybackRate.spec.d.ts +6 -0
- package/bin/test/test/GroupPlaybackRate.spec.d.ts.map +1 -0
- package/bin/test/test/GroupPlaybackRate.spec.js +47 -0
- package/bin/test/test/GroupPlaybackRate.spec.js.map +1 -0
- package/bin/test/test/GroupPlaybackTrack.spec.d.ts +6 -0
- package/bin/test/test/GroupPlaybackTrack.spec.d.ts.map +1 -0
- package/bin/test/test/GroupPlaybackTrack.spec.js +171 -0
- package/bin/test/test/GroupPlaybackTrack.spec.js.map +1 -0
- package/bin/test/test/GroupPlaybackTrackData.spec.d.ts +6 -0
- package/bin/test/test/GroupPlaybackTrackData.spec.d.ts.map +1 -0
- package/bin/test/test/GroupPlaybackTrackData.spec.js +63 -0
- package/bin/test/test/GroupPlaybackTrackData.spec.js.map +1 -0
- package/bin/test/test/LiveMediaSession_ManualActionHandler.spec.d.ts +6 -0
- package/bin/test/test/LiveMediaSession_ManualActionHandler.spec.d.ts.map +1 -0
- package/bin/test/test/LiveMediaSession_ManualActionHandler.spec.js +323 -0
- package/bin/test/test/LiveMediaSession_ManualActionHandler.spec.js.map +1 -0
- package/bin/test/test/LiveMediaSession_Synchronizer.spec.d.ts +6 -0
- package/bin/test/test/LiveMediaSession_Synchronizer.spec.d.ts.map +1 -0
- package/bin/test/test/LiveMediaSession_Synchronizer.spec.js +669 -0
- package/bin/test/test/LiveMediaSession_Synchronizer.spec.js.map +1 -0
- package/bin/test/test/PriorityTimeInterval.spec.d.ts +6 -0
- package/bin/test/test/PriorityTimeInterval.spec.d.ts.map +1 -0
- package/bin/test/test/PriorityTimeInterval.spec.js +67 -0
- package/bin/test/test/PriorityTimeInterval.spec.js.map +1 -0
- package/bin/test/test/TestUtils.d.ts +44 -0
- package/bin/test/test/TestUtils.d.ts.map +1 -0
- package/bin/test/test/TestUtils.js +116 -0
- package/bin/test/test/TestUtils.js.map +1 -0
- package/bin/test/test/VolumeManager.spec.d.ts +2 -0
- package/bin/test/test/VolumeManager.spec.d.ts.map +1 -0
- package/bin/test/test/VolumeManager.spec.js +163 -0
- package/bin/test/test/VolumeManager.spec.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
5
|
+
*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.LiveMediaSessionCoordinator = void 0;
|
|
17
|
+
const live_share_1 = require("@microsoft/live-share");
|
|
18
|
+
const internal_1 = require("@microsoft/live-share/internal");
|
|
19
|
+
const GroupCoordinatorState_js_1 = require("./internals/GroupCoordinatorState.js");
|
|
20
|
+
const consts_js_1 = require("./internals/consts.js");
|
|
21
|
+
const errors_js_1 = require("./internals/errors.js");
|
|
22
|
+
const PriorityTimeInterval_js_1 = require("./internals/PriorityTimeInterval.js");
|
|
23
|
+
const LiveMediaSessionCoordinatorSuspension_js_1 = require("./LiveMediaSessionCoordinatorSuspension.js");
|
|
24
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
25
|
+
/**
|
|
26
|
+
* The `LiveMediaSessionCoordinator` tracks the playback & position state of all other
|
|
27
|
+
* clients being synchronized with. It is responsible for keeping the local media player
|
|
28
|
+
* in sync with the group.
|
|
29
|
+
*/
|
|
30
|
+
class LiveMediaSessionCoordinator extends client_utils_1.TypedEventEmitter {
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
* Applications shouldn't directly create new coordinator instances.
|
|
34
|
+
*/
|
|
35
|
+
constructor(id, runtime, liveRuntime, getPlayerState) {
|
|
36
|
+
super();
|
|
37
|
+
this._positionUpdateInterval = new PriorityTimeInterval_js_1.PriorityTimeInterval(2000,
|
|
38
|
+
// Scale by function
|
|
39
|
+
() => {
|
|
40
|
+
const audience = this._liveRuntime.audience;
|
|
41
|
+
if (!audience)
|
|
42
|
+
return 1;
|
|
43
|
+
// As the audience size gets bigger, we relax the update interval, since more variance is expected
|
|
44
|
+
const count = audience.getMembers().size;
|
|
45
|
+
return 1 + count / 5;
|
|
46
|
+
});
|
|
47
|
+
this._maxPlaybackDrift = new PriorityTimeInterval_js_1.PriorityTimeInterval(1500, // Scale by function
|
|
48
|
+
() => {
|
|
49
|
+
const audience = this._liveRuntime.audience;
|
|
50
|
+
if (!audience)
|
|
51
|
+
return 1;
|
|
52
|
+
// As the audience size gets bigger, we relax the playback drift, since more variance is expected
|
|
53
|
+
const count = audience.getMembers().size;
|
|
54
|
+
return 1 + count / 25;
|
|
55
|
+
});
|
|
56
|
+
this.initializeState = live_share_1.LiveDataObjectInitializeState.needed;
|
|
57
|
+
/**
|
|
58
|
+
* Controls whether or not the local client is allowed to instruct the group to play or pause.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* This flag largely meant to influence decisions made by the coordinator and can be used by
|
|
62
|
+
* the UI to determine what controls should be shown to the user. It does not provide any
|
|
63
|
+
* security in itself.
|
|
64
|
+
*
|
|
65
|
+
* If your app is running in a semi-trusted environment where only some clients are allowed
|
|
66
|
+
* to play/pause media, you should use "role based verification" to enforce those policies.
|
|
67
|
+
*/
|
|
68
|
+
this.canPlayPause = true;
|
|
69
|
+
/**
|
|
70
|
+
* Controls whether or not the local client is allowed to seek the group to a new playback
|
|
71
|
+
* position.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This flag largely meant to influence decisions made by the coordinator and can be used by
|
|
75
|
+
* the UI to determine what controls should be shown to the user. It does not provide any
|
|
76
|
+
* security in itself.
|
|
77
|
+
*
|
|
78
|
+
* If your app is running in a semi-trusted environment where only some clients are allowed
|
|
79
|
+
* to change the playback position, you should use "role based verification" to enforce those policies.
|
|
80
|
+
*/
|
|
81
|
+
this.canSeek = true;
|
|
82
|
+
/**
|
|
83
|
+
* Controls whether or not the local client is allowed to change tracks.
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* This flag largely meant to influence decisions made by the coordinator and can be used by
|
|
87
|
+
* the UI to determine what controls should be shown to the user. It does not provide any
|
|
88
|
+
* security in itself.
|
|
89
|
+
*
|
|
90
|
+
* If your app is running in a semi-trusted environment where only some clients are allowed
|
|
91
|
+
* to change tracks, you should use "role based verification" to enforce those policies.
|
|
92
|
+
*/
|
|
93
|
+
this.canSetTrack = true;
|
|
94
|
+
/**
|
|
95
|
+
* Controls whether or not the local client is allowed to change the tracks custom data object.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* This flag largely meant to influence decisions made by the coordinator and can be used by
|
|
99
|
+
* the UI to determine what controls should be shown to the user. It does not provide any
|
|
100
|
+
* security in itself.
|
|
101
|
+
*
|
|
102
|
+
* If your app is running in a semi-trusted environment where only some clients are allowed
|
|
103
|
+
* to change the tracks data object, you should use "role based verification" to enforce those
|
|
104
|
+
* policies.
|
|
105
|
+
*/
|
|
106
|
+
this.canSetTrackData = true;
|
|
107
|
+
/**
|
|
108
|
+
* Controls whether or not the local client is allowed to change the playback rate.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* This flag largely meant to influence decisions made by the coordinator and can be used by
|
|
112
|
+
* the UI to determine what controls should be shown to the user. It does not provide any
|
|
113
|
+
* security in itself.
|
|
114
|
+
*
|
|
115
|
+
* If your app is running in a semi-trusted environment where only some clients are allowed
|
|
116
|
+
* to change the tracks data object, you should use "role based verification" to enforce those
|
|
117
|
+
* policies.
|
|
118
|
+
*/
|
|
119
|
+
this.canSetPlaybackRate = true;
|
|
120
|
+
/**
|
|
121
|
+
* Controls whether or not the local client is allowed to send position updates to the group.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* This flag largely meant to limit the number of signals sent to the group for performance reasons.
|
|
125
|
+
* It does not provide any security in itself.
|
|
126
|
+
*/
|
|
127
|
+
this.canSendPositionUpdates = true;
|
|
128
|
+
this._id = id;
|
|
129
|
+
this._runtime = runtime;
|
|
130
|
+
this._liveRuntime = liveRuntime;
|
|
131
|
+
this._logger = new live_share_1.LiveTelemetryLogger(runtime, liveRuntime);
|
|
132
|
+
this._getPlayerState = getPlayerState;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Returns true if the local client is in a suspended state.
|
|
136
|
+
*/
|
|
137
|
+
get isSuspended() {
|
|
138
|
+
return this._groupState ? this._groupState.isSuspended : false;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Controls whether or not to scale {@link maxPlaybackDrift} by the number of users in the session.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* As more clients join a session, it is more likely that some users will fall behind the presenter.
|
|
145
|
+
* It is also less likely that users will notice drift as more clients are added.
|
|
146
|
+
* It is usually helpful to be more lenient as more clients are added so everyone can watch all the content.
|
|
147
|
+
* Default value is true.
|
|
148
|
+
*/
|
|
149
|
+
get shouldScaleMaxPlaybackDrift() {
|
|
150
|
+
return this._maxPlaybackDrift.shouldPrioritize;
|
|
151
|
+
}
|
|
152
|
+
set shouldScaleMaxPlaybackDrift(value) {
|
|
153
|
+
this._maxPlaybackDrift.shouldPrioritize = value;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Max amount of playback drift allowed in seconds.
|
|
157
|
+
* This will scale automatically according to the number of participants in the session when {@link shouldScaleMaxPlaybackDrift} is true.
|
|
158
|
+
*
|
|
159
|
+
* @remarks
|
|
160
|
+
* Should the local clients playback position lag by more than the specified value, the coordinator will trigger a `catchup` action.
|
|
161
|
+
* Default value is `1.5` seconds.
|
|
162
|
+
*/
|
|
163
|
+
get maxPlaybackDrift() {
|
|
164
|
+
return this._maxPlaybackDrift.seconds;
|
|
165
|
+
}
|
|
166
|
+
set maxPlaybackDrift(value) {
|
|
167
|
+
this._maxPlaybackDrift.seconds = value;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Controls whether or not to compute {@link positionUpdateInterval} based on whether user has initiated a playback command.
|
|
171
|
+
* Default value is true.
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* When true, users that are simply watching but not controlling playback will report their positions less frequently.
|
|
175
|
+
* When a user has sent a transport command, they will begin sending position updates more frequently.
|
|
176
|
+
* Most Live Share apps have a concept of a primary presenter, and don't allow anyone to pause/play for the group.
|
|
177
|
+
* By ensuring only one/few users broadcast updates frequently, the server load is reduced considerably.
|
|
178
|
+
*/
|
|
179
|
+
get shouldScalePositionUpdateInterval() {
|
|
180
|
+
return this._positionUpdateInterval.shouldPrioritize;
|
|
181
|
+
}
|
|
182
|
+
set shouldScalePositionUpdateInterval(value) {
|
|
183
|
+
this._positionUpdateInterval.shouldPrioritize = value;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Frequency with which position updates are broadcast to the rest of the group in seconds.
|
|
187
|
+
* When {@link shouldScalePositionUpdateInterval} is set to `true`, the value set is the minimum value.
|
|
188
|
+
* The value returned is the actual value used to send updates by the local user, which may be larger than the value set.
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* Defaults to a minimum value of `2` seconds.
|
|
192
|
+
*/
|
|
193
|
+
get positionUpdateInterval() {
|
|
194
|
+
return this._positionUpdateInterval.seconds;
|
|
195
|
+
}
|
|
196
|
+
set positionUpdateInterval(value) {
|
|
197
|
+
this._positionUpdateInterval.seconds = value;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Instructs the group to play the current track.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* Throws an exception if the session/coordinator hasn't been initialized, no track has been
|
|
204
|
+
* loaded, or `canPlayPause` is false.
|
|
205
|
+
*
|
|
206
|
+
* @returns a void promise that resolves once complete, throws if user does not have proper roles
|
|
207
|
+
*/
|
|
208
|
+
play() {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
var _a;
|
|
211
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:play", "play", this.initializeState);
|
|
212
|
+
errors_js_1.TrackMetadataNotSetError.assert(!!((_a = this._groupState) === null || _a === void 0 ? void 0 : _a.playbackTrack.current.metadata), "LiveMediaSessionCoordinator:play", "play");
|
|
213
|
+
errors_js_1.ActionBlockedError.assert(this.canPlayPause, "LiveMediaSessionCoordinator:play", "play", "canPlayPause");
|
|
214
|
+
// Get projected position
|
|
215
|
+
const position = this.getPlayerPosition();
|
|
216
|
+
// Send transport command
|
|
217
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.PlayCalled, null, { position: position });
|
|
218
|
+
yield this._playEvent.sendEvent({
|
|
219
|
+
track: this._groupState.playbackTrack.current,
|
|
220
|
+
position: position,
|
|
221
|
+
});
|
|
222
|
+
if (this.canSendPositionUpdates) {
|
|
223
|
+
// User has taken initiative to send event, give priority for sending position updates
|
|
224
|
+
this._positionUpdateInterval.hasPriority = true;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Instructs the group to pause the current track.
|
|
230
|
+
*
|
|
231
|
+
* @remarks
|
|
232
|
+
* Throws an exception if the session/coordinator hasn't been initialized, no track has been
|
|
233
|
+
* loaded, or `canPlayPause` is false.
|
|
234
|
+
*
|
|
235
|
+
* @returns a void promise that resolves once complete, throws if user does not have proper roles
|
|
236
|
+
*/
|
|
237
|
+
pause() {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
var _a;
|
|
240
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:pause", "pause", this.initializeState);
|
|
241
|
+
errors_js_1.TrackMetadataNotSetError.assert(!!((_a = this._groupState) === null || _a === void 0 ? void 0 : _a.playbackTrack.current.metadata), "LiveMediaSessionCoordinator:pause", "pause");
|
|
242
|
+
errors_js_1.ActionBlockedError.assert(this.canPlayPause, "LiveMediaSessionCoordinator:pause", "pause", "canPlayPause");
|
|
243
|
+
// Get projected position
|
|
244
|
+
const position = this.getPlayerPosition();
|
|
245
|
+
// Send transport command
|
|
246
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.PauseCalled, null, { position: position });
|
|
247
|
+
yield this._pauseEvent.sendEvent({
|
|
248
|
+
track: this._groupState.playbackTrack.current,
|
|
249
|
+
position: position,
|
|
250
|
+
});
|
|
251
|
+
if (this.canSendPositionUpdates) {
|
|
252
|
+
// User has taken initiative to send event, give priority for sending position updates
|
|
253
|
+
this._positionUpdateInterval.hasPriority = true;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Instructs the group to seek to a new position within the current track.
|
|
259
|
+
*
|
|
260
|
+
* @remarks
|
|
261
|
+
* Throws an exception if the session/coordinator hasn't been initialized, no track has been
|
|
262
|
+
* loaded, or `canSeek` is false.
|
|
263
|
+
* @param time Playback position in seconds to seek to.
|
|
264
|
+
* @returns a void promise that resolves once complete, throws if user does not have proper roles
|
|
265
|
+
*/
|
|
266
|
+
seekTo(time) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
var _a;
|
|
269
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:seekTo", "seekTo", this.initializeState);
|
|
270
|
+
errors_js_1.TrackMetadataNotSetError.assert(!!((_a = this._groupState) === null || _a === void 0 ? void 0 : _a.playbackTrack.current.metadata), "LiveMediaSessionCoordinator:seekTo", "seekTo");
|
|
271
|
+
errors_js_1.ActionBlockedError.assert(this.canSeek, "LiveMediaSessionCoordinator:seekTo", "seekTo", "canSeek");
|
|
272
|
+
// Send transport command
|
|
273
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.SeekToCalled, null, { position: time });
|
|
274
|
+
try {
|
|
275
|
+
yield this._seekToEvent.sendEvent({
|
|
276
|
+
track: this._groupState.playbackTrack.current,
|
|
277
|
+
position: time,
|
|
278
|
+
});
|
|
279
|
+
if (this.canSendPositionUpdates) {
|
|
280
|
+
// User has taken initiative to send event, give priority for sending position updates
|
|
281
|
+
this._positionUpdateInterval.hasPriority = true;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
yield this._groupState.syncLocalMediaSession();
|
|
286
|
+
throw err;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Sets the playback rate for everyone in the session.
|
|
292
|
+
*
|
|
293
|
+
* @param playbackRate the playback rate to set.
|
|
294
|
+
*
|
|
295
|
+
* @throws
|
|
296
|
+
* Throws an exception if the session/coordinator hasn't been initialized or {@link canSetPlaybackRate} is false.
|
|
297
|
+
*/
|
|
298
|
+
setPlaybackRate(playbackRate) {
|
|
299
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:setPlaybackRate", "setPlaybackRate", this.initializeState);
|
|
301
|
+
errors_js_1.ActionBlockedError.assert(this.canSetPlaybackRate, "LiveMediaSessionCoordinator:setPlaybackRate", "setPlaybackRate", "canSetPlaybackRate");
|
|
302
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.SetPlaybackRateCalled, null, { playbackRate });
|
|
303
|
+
yield this._rateChangeEvent.sendEvent({ playbackRate });
|
|
304
|
+
if (this.canSendPositionUpdates) {
|
|
305
|
+
// User has taken initiative to send event, give priority for sending position updates
|
|
306
|
+
this._positionUpdateInterval.hasPriority = true;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Instructs the group to load a new track.
|
|
312
|
+
*
|
|
313
|
+
* @remarks
|
|
314
|
+
* Throws an exception if the session/coordinator hasn't been initialized or `canSetTrack` is
|
|
315
|
+
* false.
|
|
316
|
+
* @param metadata The track to load or `null` to indicate that the end of the track is reached.
|
|
317
|
+
* @param waitPoints Optional. List of static wait points to configure for the track. Dynamic wait points can be added via the `beginSuspension()` call.
|
|
318
|
+
* @returns a void promise that resolves once complete, throws if user does not have proper roles
|
|
319
|
+
*/
|
|
320
|
+
setTrack(metadata, waitPoints) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:setTrack", "setTrack", this.initializeState);
|
|
323
|
+
errors_js_1.ActionBlockedError.assert(this.canSetTrack, "LiveMediaSessionCoordinator:setTrack", "setTrack", "canSetTrack");
|
|
324
|
+
// Send transport command
|
|
325
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.SetTrackCalled);
|
|
326
|
+
yield this._setTrackEvent.sendEvent({
|
|
327
|
+
metadata: metadata,
|
|
328
|
+
waitPoints: waitPoints || [],
|
|
329
|
+
});
|
|
330
|
+
if (this.canSendPositionUpdates) {
|
|
331
|
+
// User has taken initiative to send event, give priority for sending position updates
|
|
332
|
+
this._positionUpdateInterval.hasPriority = true;
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Updates the track data object for the current track.
|
|
338
|
+
*
|
|
339
|
+
* @remarks
|
|
340
|
+
* The track data object can be used by applications to synchronize things like pitch, roll,
|
|
341
|
+
* and yaw of a 360 video. This data object will be reset to null anytime the track changes.
|
|
342
|
+
*
|
|
343
|
+
* Throws an exception if the session/coordinator hasn't been initialized or `canSetTrackData` is
|
|
344
|
+
* false.
|
|
345
|
+
* @param data New data object to sync with the group. This value will be synchronized using a last writer wins strategy.
|
|
346
|
+
* @returns a void promise that resolves once complete, throws if user does not have proper roles
|
|
347
|
+
*/
|
|
348
|
+
setTrackData(data) {
|
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:setTrackData", "setTrackData", this.initializeState);
|
|
351
|
+
errors_js_1.ActionBlockedError.assert(this.canSetTrackData, "LiveMediaSessionCoordinator:setTrackData", "setTrackData", "canSetTrackData");
|
|
352
|
+
// Send transport command
|
|
353
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.SetTrackDataCalled);
|
|
354
|
+
yield this._setTrackDataEvent.sendEvent({
|
|
355
|
+
data: data,
|
|
356
|
+
});
|
|
357
|
+
if (this.canSendPositionUpdates) {
|
|
358
|
+
// User has taken initiative to send event, give priority for sending position updates
|
|
359
|
+
this._positionUpdateInterval.hasPriority = true;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Begins a new local suspension.
|
|
365
|
+
*
|
|
366
|
+
* @remarks
|
|
367
|
+
* Suspension temporarily suspend the clients local synchronization with the group. This can
|
|
368
|
+
* be useful for displaying ads to users or temporarily disconnecting from the session while
|
|
369
|
+
* the user seeks the video using a timeline scrubber.
|
|
370
|
+
*
|
|
371
|
+
* Multiple simultaneous suspensions are allowed and when the last suspension ends the local
|
|
372
|
+
* client will be immediately re-synchronized with the group.
|
|
373
|
+
*
|
|
374
|
+
* A "Dynamic Wait Point" can be specified when `beginSuspension()` is called and the wait
|
|
375
|
+
* point will be broadcast to all other clients in the group. Those clients will then
|
|
376
|
+
* automatically enter a suspension state once they reach the positions specified by the
|
|
377
|
+
* wait point. Clients that are passed the wait point will immediately suspend.
|
|
378
|
+
*
|
|
379
|
+
* Any wait point based suspension (dynamic or static) will result in all clients remaining
|
|
380
|
+
* in a suspension state until the list client ends their suspension. This behavior can be
|
|
381
|
+
* conditionally bypassed by settings the wait points `maxClients` value.
|
|
382
|
+
*
|
|
383
|
+
* Throws an exception if the session/coordinator hasn't been initialized.
|
|
384
|
+
* @param waitPoint Optional. Dynamic wait point to broadcast to all of the clients.
|
|
385
|
+
* @returns The suspension object. Call `end()` on the returned suspension to end the suspension.
|
|
386
|
+
*/
|
|
387
|
+
beginSuspension(waitPoint) {
|
|
388
|
+
var _a;
|
|
389
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:beginSuspension", "beginSuspension", this.initializeState);
|
|
390
|
+
errors_js_1.TrackMetadataNotSetError.assert(!!((_a = this._groupState) === null || _a === void 0 ? void 0 : _a.playbackTrack.current.metadata), "LiveMediaSessionCoordinator:beginSuspension", "beginSuspension");
|
|
391
|
+
// Tell group state that suspension is started
|
|
392
|
+
if (waitPoint) {
|
|
393
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.BeginSuspensionAndWait, null, {
|
|
394
|
+
position: waitPoint.position,
|
|
395
|
+
maxClients: waitPoint.maxClients,
|
|
396
|
+
});
|
|
397
|
+
this._lastWaitPoint = waitPoint;
|
|
398
|
+
this._groupState.beginSuspension(waitPoint);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.BeginSuspension);
|
|
402
|
+
this._groupState.beginSuspension();
|
|
403
|
+
}
|
|
404
|
+
// Return new suspension object
|
|
405
|
+
return new LiveMediaSessionCoordinatorSuspension_js_1.LiveMediaSessionCoordinatorSuspension(waitPoint, (time) => {
|
|
406
|
+
var _a, _b;
|
|
407
|
+
if (waitPoint) {
|
|
408
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.EndSuspensionAndWait, null, {
|
|
409
|
+
position: waitPoint.position,
|
|
410
|
+
maxClients: waitPoint.maxClients,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.EndSuspension);
|
|
415
|
+
}
|
|
416
|
+
this._groupState.endSuspension(time == undefined);
|
|
417
|
+
if (time != undefined &&
|
|
418
|
+
!((_a = this._groupState) === null || _a === void 0 ? void 0 : _a.isSuspended) &&
|
|
419
|
+
!((_b = this._groupState) === null || _b === void 0 ? void 0 : _b.isWaiting)) {
|
|
420
|
+
// Seek to new position
|
|
421
|
+
this.seekTo(Math.max(time, 0.0));
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* @hidden
|
|
427
|
+
* Called by MediaSession to verify the coordinator has been initialized.
|
|
428
|
+
*/
|
|
429
|
+
get isInitialized() {
|
|
430
|
+
return this.initializeState === live_share_1.LiveDataObjectInitializeState.succeeded;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* @hidden
|
|
434
|
+
* Called by MediaSession to start coordinator.
|
|
435
|
+
*/
|
|
436
|
+
initialize(acceptTransportChangesFrom) {
|
|
437
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
438
|
+
var _a;
|
|
439
|
+
live_share_1.LiveDataObjectInitializeNotNeededError.assert("LiveMediaSessionCoordinator:initialize", this.initializeState);
|
|
440
|
+
this.initializeState = live_share_1.LiveDataObjectInitializeState.pending;
|
|
441
|
+
try {
|
|
442
|
+
// Create children
|
|
443
|
+
yield this.createChildren(acceptTransportChangesFrom);
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
this.initializeState = live_share_1.LiveDataObjectInitializeState.needed;
|
|
447
|
+
throw error;
|
|
448
|
+
}
|
|
449
|
+
this.initializeState = live_share_1.LiveDataObjectInitializeState.succeeded;
|
|
450
|
+
try {
|
|
451
|
+
// start needs to happen after setting initializedState to "succeeded"
|
|
452
|
+
yield ((_a = this._synchronizer) === null || _a === void 0 ? void 0 : _a.start({
|
|
453
|
+
initialState: undefined,
|
|
454
|
+
updateState: (evt, sender, local) => __awaiter(this, void 0, void 0, function* () { return false; }),
|
|
455
|
+
getLocalUserCanSend: (connecting) => __awaiter(this, void 0, void 0, function* () { return true; }),
|
|
456
|
+
enableBackgroundUpdates: false,
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
// not a fatal error for LiveMediaSession, only used for "connect" event to send new clients position updates.
|
|
461
|
+
this._logger.sendErrorEvent(consts_js_1.TelemetryEvents.SessionCoordinator
|
|
462
|
+
.LiveObjectSynchronizerStartError, error);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* @hidden
|
|
468
|
+
* Called by the MediaSession to detect if a wait point has been hit.
|
|
469
|
+
*/
|
|
470
|
+
findNextWaitPoint() {
|
|
471
|
+
var _a;
|
|
472
|
+
return (((_a = this._groupState) === null || _a === void 0 ? void 0 : _a.playbackTrack.findNextWaitPoint(this._lastWaitPoint)) || null);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* @hidden
|
|
476
|
+
* Called by MediaSession to trigger the sending of a position update.
|
|
477
|
+
*/
|
|
478
|
+
sendPositionUpdate(state, targetClientId) {
|
|
479
|
+
var _a, _b;
|
|
480
|
+
live_share_1.LiveDataObjectNotInitializedError.assert("LiveMediaSessionCoordinator:sendPositionUpdate", "sendPositionUpdate", this.initializeState);
|
|
481
|
+
if (this.canSendPositionUpdates) {
|
|
482
|
+
// Send position update event
|
|
483
|
+
const evt = this._groupState.createPositionUpdateEvent(state);
|
|
484
|
+
(_a = this._positionUpdateEvent) === null || _a === void 0 ? void 0 : _a.sendEvent(evt, targetClientId).catch((err) => {
|
|
485
|
+
this._logger.sendErrorEvent(consts_js_1.TelemetryEvents.SessionCoordinator
|
|
486
|
+
.PositionUpdateEventError, err);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
else if (this.isSuspended) {
|
|
490
|
+
// send a local only position update event that was not sent as a signal, and use to handle local
|
|
491
|
+
// position update for clients that have canSendPositionUpdates==false, but are suspending
|
|
492
|
+
const evt = this._groupState.createPositionUpdateEvent(state);
|
|
493
|
+
(_b = this._positionUpdateEvent) === null || _b === void 0 ? void 0 : _b.sendLocalEvent(evt).catch((err) => {
|
|
494
|
+
this._logger.sendErrorEvent(consts_js_1.TelemetryEvents.SessionCoordinator.PositionUpdateEventError, err);
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
// make sure position is synced to position of clients who can send position updates
|
|
499
|
+
this._groupState.syncLocalMediaSession();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
createChildren(acceptTransportChangesFrom) {
|
|
503
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
504
|
+
// Create event scopes
|
|
505
|
+
const scope = new internal_1.LiveEventScope(this._runtime, this._liveRuntime, acceptTransportChangesFrom);
|
|
506
|
+
const unrestrictedScope = new internal_1.LiveEventScope(this._runtime, this._liveRuntime);
|
|
507
|
+
// Initialize internal coordinator state
|
|
508
|
+
this._groupState = new GroupCoordinatorState_js_1.GroupCoordinatorState(this._runtime, this._liveRuntime, this._maxPlaybackDrift, this._positionUpdateInterval, this._getPlayerState);
|
|
509
|
+
this._groupState.on(GroupCoordinatorState_js_1.GroupCoordinatorStateEvents.triggeraction, (evt) => this.emit(evt.name, evt));
|
|
510
|
+
this._groupState.on(GroupCoordinatorState_js_1.GroupCoordinatorStateEvents.triggeractionignored, (evt) => this.emit(evt.name, evt));
|
|
511
|
+
// Listen for track changes
|
|
512
|
+
this._setTrackEvent = new internal_1.LiveEventTarget(scope, "setTrack", (event, local) => this._groupState.handleSetTrack(event, local));
|
|
513
|
+
this._setTrackDataEvent = new internal_1.LiveEventTarget(scope, "setTrackData", (event, local) => this._groupState.handleSetTrackData(event, local));
|
|
514
|
+
// Listen for transport commands
|
|
515
|
+
this._playEvent = new internal_1.LiveEventTarget(scope, "play", (event, local) => this._groupState.handleTransportCommand(event, local));
|
|
516
|
+
this._pauseEvent = new internal_1.LiveEventTarget(scope, "pause", (event, local) => this._groupState.handleTransportCommand(event, local));
|
|
517
|
+
this._seekToEvent = new internal_1.LiveEventTarget(scope, "seekTo", (event, local) => this._groupState.handleTransportCommand(event, local));
|
|
518
|
+
this._rateChangeEvent = new internal_1.LiveEventTarget(scope, "rateChange", (event, local) => {
|
|
519
|
+
this._groupState.handleRateChangeCommand(event, local);
|
|
520
|
+
});
|
|
521
|
+
// Listen for position updates
|
|
522
|
+
this._positionUpdateEvent = new internal_1.LiveEventTarget(unrestrictedScope, "positionUpdate", (event, local) => this._groupState.handlePositionUpdate(event, local));
|
|
523
|
+
this._synchronizer = new internal_1.LiveObjectSynchronizer(this._id, this._runtime, this._liveRuntime);
|
|
524
|
+
this._synchronizer.onJoinedListener = (clientId, timestamp) => {
|
|
525
|
+
this._logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.SessionCoordinator.RemoteConnectReceived, null, {
|
|
526
|
+
correlationId: live_share_1.LiveTelemetryLogger.formatCorrelationId(clientId, timestamp),
|
|
527
|
+
});
|
|
528
|
+
// Immediately send a position update
|
|
529
|
+
try {
|
|
530
|
+
const state = this._getPlayerState();
|
|
531
|
+
// Send only to the user that joined the session using the targetClientId prop.
|
|
532
|
+
// This ensures that only the user that connected receives this one-time position update, minimizing costs.
|
|
533
|
+
this.sendPositionUpdate(state, clientId);
|
|
534
|
+
}
|
|
535
|
+
catch (err) {
|
|
536
|
+
// if player is not setup yet, local client might have also just joined and can't send its position.
|
|
537
|
+
const playerNotSetup = (0, internal_1.isErrorLike)(err) &&
|
|
538
|
+
err.message.includes("LiveMediaSession:getCurrentPlayerState");
|
|
539
|
+
if (!playerNotSetup) {
|
|
540
|
+
throw err;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
getPlayerPosition() {
|
|
547
|
+
const { positionState, playbackState } = this._getPlayerState();
|
|
548
|
+
switch (playbackState) {
|
|
549
|
+
case "none":
|
|
550
|
+
case "ended":
|
|
551
|
+
return 0.0;
|
|
552
|
+
default:
|
|
553
|
+
return positionState && positionState.position != undefined
|
|
554
|
+
? positionState.position
|
|
555
|
+
: 0.0;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
exports.LiveMediaSessionCoordinator = LiveMediaSessionCoordinator;
|
|
560
|
+
//# sourceMappingURL=LiveMediaSessionCoordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMediaSessionCoordinator.js","sourceRoot":"","sources":["../../src/LiveMediaSessionCoordinator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,sDAQ+B;AAC/B,6DAOwC;AAOxC,mFAQ8C;AAC9C,qDAAwD;AACxD,qDAG+B;AAC/B,iFAA2E;AAC3E,yGAAmG;AACnG,+DAAiE;AA4CjE;;;;GAIG;AACH,MAAa,2BAA4B,SAAQ,gCAAqD;IA+ClG;;;OAGG;IACH,YACI,EAAU,EACV,OAAyB,EACzB,WAA6B,EAC7B,cAAuC;Q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AqC;gBACrC,IAAI,CAAC;oBACD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;oBACrC,+EAA+E;oBAC/E,2GAA2G;oBAC3G,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBAC7C,CAAC;gBAAC,OAAO,GAAQ,EAAE,CAAC;oBAChB,oGAAoG;oBACpG,MAAM,cAAc,GAChB,IAAA,sBAAW,EAAC,GAAG,CAAC;wBAChB,GAAG,CAAC,OAAO,CAAC,QAAQ,CAChB,wCAAwC,CAC3C,CAAC;oBACN,IAAI,CAAC,cAAc,EAAE,CAAC;wBAClB,MAAM,GAAG,CAAC;oBACd,CAAC;gBACL,CAAC;YACL,CAAC,CAAC;QACN,CAAC;KAAA;IAEO,iBAAiB;QACrB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAChE,QAAQ,aAAa,EAAE,CAAC;YACpB,KAAK,MAAM,CAAC;YACZ,KAAK,OAAO;gBACR,OAAO,GAAG,CAAC;YACf;gBACI,OAAO,aAAa,IAAI,aAAa,CAAC,QAAQ,IAAI,SAAS;oBACvD,CAAC,CAAC,aAAa,CAAC,QAAQ;oBACxB,CAAC,CAAC,GAAG,CAAC;QAClB,CAAC;IACL,CAAC;CACJ;AA1wBD,kEA0wBC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
import { MediaSessionCoordinatorSuspension, CoordinationWaitPoint } from "./MediaSessionExtensions.js";
|
|
6
|
+
export declare class LiveMediaSessionCoordinatorSuspension implements MediaSessionCoordinatorSuspension {
|
|
7
|
+
private _waitPoint?;
|
|
8
|
+
private _onEnd;
|
|
9
|
+
constructor(waitPoint: CoordinationWaitPoint | undefined, onEnd: (seekTo?: number) => void);
|
|
10
|
+
/**
|
|
11
|
+
* Returns an optional wait point associated with the suspension.
|
|
12
|
+
*/
|
|
13
|
+
get waitPoint(): CoordinationWaitPoint | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Ends the suspension and optionally proposes a time to seek to.
|
|
16
|
+
* @param seekTo Optional. Proposed time to seek to. Ignored for suspensions at wait points.
|
|
17
|
+
*/
|
|
18
|
+
end(seekTo?: number): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=LiveMediaSessionCoordinatorSuspension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMediaSessionCoordinatorSuspension.d.ts","sourceRoot":"","sources":["../../src/LiveMediaSessionCoordinatorSuspension.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,iCAAiC,EACjC,qBAAqB,EACxB,MAAM,6BAA6B,CAAC;AAErC,qBAAa,qCACT,YAAW,iCAAiC;IAE5C,OAAO,CAAC,UAAU,CAAC,CAAwB;IAC3C,OAAO,CAAC,MAAM,CAA4B;gBAGtC,SAAS,EAAE,qBAAqB,GAAG,SAAS,EAC5C,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI;IAMpC;;OAEG;IACH,IAAW,SAAS,IAAI,qBAAqB,GAAG,SAAS,CAExD;IAED;;;OAGG;IACI,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;CAGpC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.LiveMediaSessionCoordinatorSuspension = void 0;
|
|
8
|
+
class LiveMediaSessionCoordinatorSuspension {
|
|
9
|
+
constructor(waitPoint, onEnd) {
|
|
10
|
+
this._waitPoint = waitPoint;
|
|
11
|
+
this._onEnd = onEnd;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns an optional wait point associated with the suspension.
|
|
15
|
+
*/
|
|
16
|
+
get waitPoint() {
|
|
17
|
+
return this._waitPoint;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Ends the suspension and optionally proposes a time to seek to.
|
|
21
|
+
* @param seekTo Optional. Proposed time to seek to. Ignored for suspensions at wait points.
|
|
22
|
+
*/
|
|
23
|
+
end(seekTo) {
|
|
24
|
+
this._onEnd(seekTo);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.LiveMediaSessionCoordinatorSuspension = LiveMediaSessionCoordinatorSuspension;
|
|
28
|
+
//# sourceMappingURL=LiveMediaSessionCoordinatorSuspension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMediaSessionCoordinatorSuspension.js","sourceRoot":"","sources":["../../src/LiveMediaSessionCoordinatorSuspension.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,MAAa,qCAAqC;IAM9C,YACI,SAA4C,EAC5C,KAAgC;QAEhC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,MAAe;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;CACJ;AA5BD,sFA4BC"}
|