@microsoft/live-share-media 1.3.0 → 1.4.0

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.
Files changed (78) hide show
  1. package/.nycrc.json +10 -10
  2. package/LICENSE +90 -90
  3. package/README.md +135 -135
  4. package/bin/LiveMediaSession.d.ts.map +1 -1
  5. package/bin/LiveMediaSession.js +9 -1
  6. package/bin/LiveMediaSession.js.map +1 -1
  7. package/bin/LiveMediaSessionCoordinator.d.ts +18 -2
  8. package/bin/LiveMediaSessionCoordinator.d.ts.map +1 -1
  9. package/bin/LiveMediaSessionCoordinator.js +52 -13
  10. package/bin/LiveMediaSessionCoordinator.js.map +1 -1
  11. package/bin/MediaPlayerSynchronizer.d.ts +6 -4
  12. package/bin/MediaPlayerSynchronizer.d.ts.map +1 -1
  13. package/bin/MediaPlayerSynchronizer.js +41 -12
  14. package/bin/MediaPlayerSynchronizer.js.map +1 -1
  15. package/bin/MediaSessionExtensions.d.ts +17 -8
  16. package/bin/MediaSessionExtensions.d.ts.map +1 -1
  17. package/bin/MediaSessionExtensions.js +4 -0
  18. package/bin/MediaSessionExtensions.js.map +1 -1
  19. package/bin/internals/GroupCoordinatorState.d.ts +15 -1
  20. package/bin/internals/GroupCoordinatorState.d.ts.map +1 -1
  21. package/bin/internals/GroupCoordinatorState.js +123 -57
  22. package/bin/internals/GroupCoordinatorState.js.map +1 -1
  23. package/bin/internals/GroupPlaybackPosition.d.ts +3 -1
  24. package/bin/internals/GroupPlaybackPosition.d.ts.map +1 -1
  25. package/bin/internals/GroupPlaybackPosition.js +7 -3
  26. package/bin/internals/GroupPlaybackPosition.js.map +1 -1
  27. package/bin/internals/GroupPlaybackRate.d.ts +39 -0
  28. package/bin/internals/GroupPlaybackRate.d.ts.map +1 -0
  29. package/bin/internals/GroupPlaybackRate.js +62 -0
  30. package/bin/internals/GroupPlaybackRate.js.map +1 -0
  31. package/bin/internals/GroupPlaybackTrack.d.ts +2 -2
  32. package/bin/internals/GroupPlaybackTrack.d.ts.map +1 -1
  33. package/bin/internals/GroupPlaybackTrack.js +3 -2
  34. package/bin/internals/GroupPlaybackTrack.js.map +1 -1
  35. package/bin/internals/GroupPlaybackTrackData.d.ts +3 -3
  36. package/bin/internals/GroupPlaybackTrackData.d.ts.map +1 -1
  37. package/bin/internals/GroupPlaybackTrackData.js +12 -11
  38. package/bin/internals/GroupPlaybackTrackData.js.map +1 -1
  39. package/bin/internals/GroupTransportState.d.ts +6 -3
  40. package/bin/internals/GroupTransportState.d.ts.map +1 -1
  41. package/bin/internals/GroupTransportState.js +16 -11
  42. package/bin/internals/GroupTransportState.js.map +1 -1
  43. package/bin/internals/consts.d.ts +10 -3
  44. package/bin/internals/consts.d.ts.map +1 -1
  45. package/bin/internals/consts.js +10 -3
  46. package/bin/internals/consts.js.map +1 -1
  47. package/bin/internals/index.d.ts +1 -0
  48. package/bin/internals/index.d.ts.map +1 -1
  49. package/bin/internals/index.js +1 -0
  50. package/bin/internals/index.js.map +1 -1
  51. package/bin/internals/interfaces.d.ts +10 -0
  52. package/bin/internals/interfaces.d.ts.map +1 -0
  53. package/bin/internals/interfaces.js +3 -0
  54. package/bin/internals/interfaces.js.map +1 -0
  55. package/package.json +45 -45
  56. package/src/IMediaPlayer.ts +29 -29
  57. package/src/LiveMediaSession.ts +349 -336
  58. package/src/LiveMediaSessionCoordinator.ts +760 -678
  59. package/src/LiveMediaSessionCoordinatorSuspension.ts +39 -39
  60. package/src/MediaPlayerSynchronizer.ts +754 -714
  61. package/src/MediaSessionActionThrottler.ts +19 -19
  62. package/src/MediaSessionExtensions.ts +198 -187
  63. package/src/RepeatedActionThrottler.ts +76 -76
  64. package/src/VolumeManager.ts +200 -200
  65. package/src/index.ts +14 -14
  66. package/src/internals/GroupCoordinatorState.ts +802 -685
  67. package/src/internals/GroupPlaybackPosition.ts +235 -228
  68. package/src/internals/GroupPlaybackRate.ts +90 -0
  69. package/src/internals/GroupPlaybackTrack.ts +183 -182
  70. package/src/internals/GroupPlaybackTrackData.ts +105 -104
  71. package/src/internals/GroupTransportState.ts +179 -170
  72. package/src/internals/consts.ts +115 -102
  73. package/src/internals/errors.ts +42 -42
  74. package/src/internals/index.ts +13 -12
  75. package/src/internals/interfaces.ts +10 -0
  76. package/tsconfig.build.json +8 -8
  77. package/tsconfig.json +76 -76
  78. package/typedoc.json +10 -10
@@ -1,170 +1,179 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
-
6
- import { ILiveEvent, LiveShareRuntime } from "@microsoft/live-share";
7
- import EventEmitter from "events";
8
- import { IMediaPlayerState } from "../LiveMediaSessionCoordinator";
9
- import {
10
- ExtendedMediaSessionPlaybackState,
11
- ExtendedMediaSessionAction,
12
- ExtendedMediaSessionActionSource,
13
- } from "../MediaSessionExtensions";
14
- import {
15
- GroupPlaybackTrack,
16
- GroupPlaybackTrackEvents,
17
- } from "./GroupPlaybackTrack";
18
-
19
- /**
20
- * @hidden
21
- */
22
- export interface ITransportState {
23
- playbackState: ExtendedMediaSessionPlaybackState;
24
- startPosition: number;
25
- timestamp: number;
26
- clientId: string;
27
- }
28
-
29
- /**
30
- * @hidden
31
- */
32
- export enum GroupTransportStateEvents {
33
- transportStateChange = "transportStateChange",
34
- }
35
-
36
- /**
37
- * @hidden
38
- */
39
- export interface ITransportStateChangeEvent extends ILiveEvent {
40
- action: ExtendedMediaSessionAction;
41
- seekTime?: number;
42
- }
43
-
44
- /**
45
- * @hidden
46
- */
47
- export class GroupTransportState extends EventEmitter {
48
- private readonly _getMediaPlayerState: () => IMediaPlayerState;
49
- private _track: GroupPlaybackTrack;
50
- private readonly _liveRuntime: LiveShareRuntime;
51
- private _current: ITransportState;
52
-
53
- constructor(
54
- track: GroupPlaybackTrack,
55
- getMediaPlayerState: () => IMediaPlayerState,
56
- liveRuntime: LiveShareRuntime
57
- ) {
58
- super();
59
- this._liveRuntime = liveRuntime;
60
- this._getMediaPlayerState = getMediaPlayerState;
61
- this._track = track;
62
- this._current = {
63
- playbackState: "none",
64
- startPosition: 0.0,
65
- timestamp: 0,
66
- clientId: "",
67
- };
68
-
69
- // Listen for track changes
70
- this._track.on(GroupPlaybackTrackEvents.trackChange, () => {
71
- // Track changed so reset state to stopped ad position 0.0
72
- this._current = {
73
- playbackState: "none",
74
- startPosition: 0.0,
75
- timestamp: this._track.current.timestamp,
76
- clientId: this._track.current.clientId,
77
- };
78
- });
79
- }
80
-
81
- public get current(): Readonly<ITransportState> {
82
- return this._current;
83
- }
84
-
85
- public get playbackState(): ExtendedMediaSessionPlaybackState {
86
- return this.current.playbackState;
87
- }
88
-
89
- public get startPosition(): number {
90
- return this.current.startPosition;
91
- }
92
-
93
- public get timestamp(): number {
94
- return this.current.timestamp;
95
- }
96
-
97
- public get track(): GroupPlaybackTrack {
98
- return this._track;
99
- }
100
-
101
- public compare(state: ITransportState): boolean {
102
- return (
103
- this.current.playbackState == state.playbackState &&
104
- this.current.startPosition == state.startPosition
105
- );
106
- }
107
-
108
- public updateState(
109
- state: ITransportState,
110
- source: ExtendedMediaSessionActionSource
111
- ): boolean {
112
- // Ignore if same playback state and start position
113
- if (this.compare(state)) {
114
- return false;
115
- }
116
-
117
- // Ignore state changes that are older
118
- const originalState = this.current;
119
- if (state.timestamp < originalState.timestamp) {
120
- return false;
121
- }
122
-
123
- // Ignore state changes that have the same timestamp and the clientId sorts higher.
124
- if (
125
- state.timestamp == originalState.timestamp &&
126
- state.clientId.localeCompare(originalState.clientId) > 0
127
- ) {
128
- return false;
129
- }
130
-
131
- // Update playback state
132
- this._current = state;
133
-
134
- // Trigger transport change
135
- const playerState = this._getMediaPlayerState().playbackState;
136
- if (
137
- originalState.playbackState == state.playbackState &&
138
- playerState != "ended"
139
- ) {
140
- this.emit(GroupTransportStateEvents.transportStateChange, {
141
- type: GroupTransportStateEvents.transportStateChange,
142
- action: "seekto",
143
- clientId: state.clientId,
144
- seekTime: state.startPosition,
145
- source,
146
- });
147
- } else if (state.playbackState == "playing") {
148
- const now = this._liveRuntime.getTimestamp();
149
- const projectedPosition =
150
- state.startPosition + (now - state.timestamp) / 1000;
151
- this.emit(GroupTransportStateEvents.transportStateChange, {
152
- type: GroupTransportStateEvents.transportStateChange,
153
- action: "play",
154
- clientId: state.clientId,
155
- seekTime: projectedPosition,
156
- source,
157
- });
158
- } else {
159
- this.emit(GroupTransportStateEvents.transportStateChange, {
160
- type: GroupTransportStateEvents.transportStateChange,
161
- action: "pause",
162
- clientId: state.clientId,
163
- seekTime: state.startPosition,
164
- source,
165
- });
166
- }
167
-
168
- return true;
169
- }
170
- }
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+
6
+ import { LiveShareRuntime } from "@microsoft/live-share";
7
+ import EventEmitter from "events";
8
+ import { IMediaPlayerState } from "../LiveMediaSessionCoordinator";
9
+ import {
10
+ ExtendedMediaSessionPlaybackState,
11
+ ExtendedMediaSessionAction,
12
+ ExtendedMediaSessionActionSource,
13
+ } from "../MediaSessionExtensions";
14
+ import {
15
+ GroupPlaybackTrack,
16
+ GroupPlaybackTrackEvents,
17
+ } from "./GroupPlaybackTrack";
18
+ import { IGroupStateEvent } from "./interfaces";
19
+ import { GroupPlaybackRate } from "./GroupPlaybackRate";
20
+
21
+ /**
22
+ * @hidden
23
+ */
24
+ export interface ITransportState {
25
+ playbackState: ExtendedMediaSessionPlaybackState;
26
+ startPosition: number;
27
+ timestamp: number;
28
+ clientId: string;
29
+ }
30
+
31
+ /**
32
+ * @hidden
33
+ */
34
+ export enum GroupTransportStateEvents {
35
+ transportStateChange = "transportStateChange",
36
+ }
37
+
38
+ /**
39
+ * @hidden
40
+ */
41
+ export interface ITransportStateChangeEvent extends IGroupStateEvent {
42
+ action: ExtendedMediaSessionAction;
43
+ seekTime?: number;
44
+ }
45
+
46
+ /**
47
+ * @hidden
48
+ */
49
+ export class GroupTransportState extends EventEmitter {
50
+ private readonly _getMediaPlayerState: () => IMediaPlayerState;
51
+ private _track: GroupPlaybackTrack;
52
+ private _playbackRate: GroupPlaybackRate;
53
+ private readonly _liveRuntime: LiveShareRuntime;
54
+ private _current: ITransportState;
55
+
56
+ constructor(
57
+ track: GroupPlaybackTrack,
58
+ playbackRate: GroupPlaybackRate,
59
+ getMediaPlayerState: () => IMediaPlayerState,
60
+ liveRuntime: LiveShareRuntime
61
+ ) {
62
+ super();
63
+ this._liveRuntime = liveRuntime;
64
+ this._getMediaPlayerState = getMediaPlayerState;
65
+ this._track = track;
66
+ this._playbackRate = playbackRate;
67
+ this._current = {
68
+ playbackState: "none",
69
+ startPosition: 0.0,
70
+ timestamp: 0,
71
+ clientId: "",
72
+ };
73
+
74
+ // Listen for track changes
75
+ this._track.on(GroupPlaybackTrackEvents.trackChange, () => {
76
+ // Track changed so reset state to stopped ad position 0.0
77
+ this._current = {
78
+ playbackState: "none",
79
+ startPosition: 0.0,
80
+ timestamp: this._track.current.timestamp,
81
+ clientId: this._track.current.clientId,
82
+ };
83
+ });
84
+ }
85
+
86
+ public get current(): Readonly<ITransportState> {
87
+ return this._current;
88
+ }
89
+
90
+ public get playbackState(): ExtendedMediaSessionPlaybackState {
91
+ return this.current.playbackState;
92
+ }
93
+
94
+ public get startPosition(): number {
95
+ return this.current.startPosition;
96
+ }
97
+
98
+ public get timestamp(): number {
99
+ return this.current.timestamp;
100
+ }
101
+
102
+ public get track(): GroupPlaybackTrack {
103
+ return this._track;
104
+ }
105
+
106
+ public compare(state: ITransportState): boolean {
107
+ return (
108
+ this.current.playbackState == state.playbackState &&
109
+ this.current.startPosition == state.startPosition
110
+ );
111
+ }
112
+
113
+ public updateState(
114
+ state: ITransportState,
115
+ source: ExtendedMediaSessionActionSource
116
+ ): boolean {
117
+ // Ignore if same playback state and start position
118
+ if (this.compare(state)) {
119
+ return false;
120
+ }
121
+
122
+ // Ignore state changes that are older
123
+ const originalState = this.current;
124
+ if (state.timestamp < originalState.timestamp) {
125
+ return false;
126
+ }
127
+
128
+ // Ignore state changes that have the same timestamp and the clientId sorts higher.
129
+ if (
130
+ state.timestamp == originalState.timestamp &&
131
+ state.clientId.localeCompare(originalState.clientId) > 0
132
+ ) {
133
+ return false;
134
+ }
135
+
136
+ // Update playback state
137
+ this._current = state;
138
+
139
+ // Trigger transport change
140
+ const playerState = this._getMediaPlayerState().playbackState;
141
+ if (
142
+ originalState.playbackState == state.playbackState &&
143
+ playerState != "ended"
144
+ ) {
145
+ const event: ITransportStateChangeEvent = {
146
+ name: GroupTransportStateEvents.transportStateChange,
147
+ action: "seekto",
148
+ clientId: state.clientId,
149
+ seekTime: state.startPosition,
150
+ source,
151
+ };
152
+ this.emit(GroupTransportStateEvents.transportStateChange, event);
153
+ } else if (state.playbackState == "playing") {
154
+ const now = this._liveRuntime.getTimestamp();
155
+ const projectedPosition =
156
+ state.startPosition +
157
+ ((now - state.timestamp) / 1000) * this._playbackRate.rate;
158
+ const event: ITransportStateChangeEvent = {
159
+ name: GroupTransportStateEvents.transportStateChange,
160
+ action: "play",
161
+ clientId: state.clientId,
162
+ seekTime: projectedPosition,
163
+ source,
164
+ };
165
+ this.emit(GroupTransportStateEvents.transportStateChange, event);
166
+ } else {
167
+ const event: ITransportStateChangeEvent = {
168
+ name: GroupTransportStateEvents.transportStateChange,
169
+ action: "pause",
170
+ clientId: state.clientId,
171
+ seekTime: state.startPosition,
172
+ source,
173
+ };
174
+ this.emit(GroupTransportStateEvents.transportStateChange, event);
175
+ }
176
+
177
+ return true;
178
+ }
179
+ }
@@ -1,102 +1,115 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
-
6
- /**
7
- * @hidden
8
- * List of telemetry events. Wrap with a call to transmit() if the event should be transmitted to
9
- * the telemetry service.
10
- */
11
- export const TelemetryEvents = {
12
- MediaPlayerSynchronizer: {
13
- SynchronizationStarted:
14
- "MediaPlayerSynchronizer:SynchronizationStarted",
15
- PlayerEvent: "MediaPlayerSynchronizer:PlayerEvent",
16
- PlayAction: "MediaPlayerSynchronizer:PlayAction",
17
- PauseAction: "MediaPlayerSynchronizer:PauseAction",
18
- SeekToAction: "MediaPlayerSynchronizer:SeekToAction",
19
- CatchupAction: "MediaPlayerSynchronizer:CatchupAction",
20
- SetTrackAction: "MediaPlayerSynchronizer:SetTrackAction",
21
- DataChangeAction: "MediaPlayerSynchronizer:DataChangeAction",
22
- UserTappedVideoToPlay: transmit(
23
- "MediaPlayerSynchronizer:UserTappedVideoToPlay"
24
- ),
25
- UserTappedVideoToPlayError:
26
- "MediaPlayerSynchronizer:UserTappedVideoToPlayError",
27
- PlaybackRateChangeBlocked:
28
- "MediaPlayerSynchronizer:PlaybackRateChangeBlocked",
29
- PlayerBlockedOperation: transmit(
30
- "MediaPlayerSynchronizer:PlayerBlockedOperation"
31
- ),
32
- SeekingPlayerToStartPosition:
33
- "MediaPlayerSynchronizer:SeekingPlayerToStartPosition",
34
- BeginSeekCalled: "MediaPlayerSynchronizer:BeginSeekCalled",
35
- EndSeekCalled: "MediaPlayerSynchronizer:EndSeekCalled",
36
- PlayCalled: "MediaPlayerSynchronizer:PlayCalled",
37
- PauseCalled: "MediaPlayerSynchronizer:PauseCalled",
38
- SeekToCalled: "MediaPlayerSynchronizer:SeekToCalled",
39
- SetTrackCalled: "MediaPlayerSynchronizer:SetTrackCalled",
40
- SetTrackDataCalled: "MediaPlayerSynchronizer:SetTrackDataCalled",
41
- },
42
- MediaSession: {
43
- PlayAction: transmit("MediaSession:PlayAction"),
44
- PauseAction: transmit("MediaSession:PauseAction"),
45
- SeekToAction: transmit("MediaSession:SeekToAction"),
46
- CatchUpAction: transmit("MediaSession:CatchUpAction"),
47
- SetTrackAction: transmit("MediaSession:SetTrackAction"),
48
- DataChangeAction: "MediaSession:DataChangeAction",
49
- BeginPositionUpdateTimer: "MediaSession:BeginPositionUpdateTimer",
50
- },
51
- SessionCoordinator: {
52
- PlayCalled: transmit("SessionCoordinator:PlayCalled"),
53
- PauseCalled: transmit("SessionCoordinator:PauseCalled"),
54
- SeekToCalled: transmit("SessionCoordinator:SeekToCalled"),
55
- SetTrackCalled: transmit("SessionCoordinator:SetTrackCalled"),
56
- SetTrackDataCalled: "SessionCoordinator:SetTrackDataCalled",
57
- BeginSuspension: "SessionCoordinator:BeginSuspension",
58
- BeginSuspensionAndWait: transmit(
59
- "SessionCoordinator:BeginSuspensionAndWait"
60
- ),
61
- EndSuspension: "SessionCoordinator:EndSuspension",
62
- EndSuspensionAndWait: transmit(
63
- "SessionCoordinator:EndSuspensionAndWait"
64
- ),
65
- RemoteJoinReceived: "SessionCoordinator:RemoteJoinReceived",
66
- RemoteSetTrackReceived: transmit(
67
- "SessionCoordinator:RemoteSetTrackReceived"
68
- ),
69
- RemoteSetTrackDataReceived: transmit(
70
- "SessionCoordinator:RemoteSetTrackDataReceived"
71
- ),
72
- RemotePlayReceived: transmit("SessionCoordinator:RemotePlayReceived"),
73
- RemotePauseReceived: transmit("SessionCoordinator:RemotePauseReceived"),
74
- RemoteSeekToReceived: transmit(
75
- "SessionCoordinator:RemoteSeekToReceived"
76
- ),
77
- PositionUpdateEventError: "SessionCoordinator:PositionUpdateEventError",
78
- SendJoinedEventError: "SessionCoordinator:SendJoinedEventError",
79
- },
80
- GroupCoordinator: {
81
- TrackChanged: "GroupCoordinator:TrackChanged",
82
- TrackChangeDelayed: "GroupCoordinator:TrackChangeDelayed",
83
- TrackDataChanged: "GroupCoordinator:TrackDataChanged",
84
- TrackDataChangeDelayed: "GroupCoordinator:TrackDataChangeDelayed",
85
- TransportStateChanged: "GroupCoordinator:TransportStateChanged",
86
- TransportStateChangeDelayed:
87
- "GroupCoordinator:TransportStateChangeDelayed",
88
- BeginSoftSuspension: "GroupCoordinator:BeginSoftSuspension",
89
- CheckingForSyncIssues: "GroupCoordinator:CheckingForSyncIssues",
90
- TrackOutOfSync: transmit("GroupCoordinator:TrackOutOfSync"),
91
- TrackDataOutOfSync: transmit("GroupCoordinator:TrackDataOutOfSync"),
92
- TransportOutOfSync: transmit("GroupCoordinator:TransportOutOfSync"),
93
- PositionOutOfSync: transmit("GroupCoordinator:PositionOutOfSync"),
94
- },
95
- };
96
-
97
- /**
98
- * @hidden
99
- */
100
- function transmit(eventName: string): string {
101
- return `${eventName}#transmit`;
102
- }
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+
6
+ /**
7
+ * @hidden
8
+ * List of telemetry events. Wrap with a call to transmit() if the event should be transmitted to
9
+ * the telemetry service.
10
+ */
11
+ export const TelemetryEvents = {
12
+ MediaPlayerSynchronizer: {
13
+ SynchronizationStarted:
14
+ "MediaPlayerSynchronizer:SynchronizationStarted",
15
+ PlayerEvent: "MediaPlayerSynchronizer:PlayerEvent",
16
+ PlayAction: "MediaPlayerSynchronizer:PlayAction",
17
+ PauseAction: "MediaPlayerSynchronizer:PauseAction",
18
+ SeekToAction: "MediaPlayerSynchronizer:SeekToAction",
19
+ RateChangeAction: "MediaPlayerSynchronizer:RateChangeAction",
20
+ CatchupAction: "MediaPlayerSynchronizer:CatchupAction",
21
+ SetTrackAction: "MediaPlayerSynchronizer:SetTrackAction",
22
+ DataChangeAction: "MediaPlayerSynchronizer:DataChangeAction",
23
+ UserTappedVideoToPlay: transmit(
24
+ "MediaPlayerSynchronizer:UserTappedVideoToPlay"
25
+ ),
26
+ UserTappedVideoToPlayError:
27
+ "MediaPlayerSynchronizer:UserTappedVideoToPlayError",
28
+ PlayerBlockedOperation: transmit(
29
+ "MediaPlayerSynchronizer:PlayerBlockedOperation"
30
+ ),
31
+ SeekingPlayerToStartPosition:
32
+ "MediaPlayerSynchronizer:SeekingPlayerToStartPosition",
33
+ BeginSeekCalled: "MediaPlayerSynchronizer:BeginSeekCalled",
34
+ EndSeekCalled: "MediaPlayerSynchronizer:EndSeekCalled",
35
+ PlayCalled: "MediaPlayerSynchronizer:PlayCalled",
36
+ PauseCalled: "MediaPlayerSynchronizer:PauseCalled",
37
+ SeekToCalled: "MediaPlayerSynchronizer:SeekToCalled",
38
+ RateChangeCalled: "MediaSession:RateChangeCalled",
39
+ SetTrackCalled: "MediaPlayerSynchronizer:SetTrackCalled",
40
+ SetTrackDataCalled: "MediaPlayerSynchronizer:SetTrackDataCalled",
41
+ },
42
+ MediaSession: {
43
+ PlayAction: transmit("MediaSession:PlayAction"),
44
+ PauseAction: transmit("MediaSession:PauseAction"),
45
+ SeekToAction: transmit("MediaSession:SeekToAction"),
46
+ RateChangeAction: transmit("MediaSession:RateChangeAction"),
47
+ CatchUpAction: transmit("MediaSession:CatchUpAction"),
48
+ SetTrackAction: transmit("MediaSession:SetTrackAction"),
49
+ DataChangeAction: "MediaSession:DataChangeAction",
50
+ BeginPositionUpdateTimer: "MediaSession:BeginPositionUpdateTimer",
51
+ },
52
+ SessionCoordinator: {
53
+ PlayCalled: transmit("SessionCoordinator:PlayCalled"),
54
+ PauseCalled: transmit("SessionCoordinator:PauseCalled"),
55
+ SeekToCalled: transmit("SessionCoordinator:SeekToCalled"),
56
+ SetPlaybackRateCalled: transmit(
57
+ "SessionCoordinator:SetPlaybackRateCalled"
58
+ ),
59
+ SetTrackCalled: transmit("SessionCoordinator:SetTrackCalled"),
60
+ SetTrackDataCalled: "SessionCoordinator:SetTrackDataCalled",
61
+ BeginSuspension: "SessionCoordinator:BeginSuspension",
62
+ BeginSuspensionAndWait: transmit(
63
+ "SessionCoordinator:BeginSuspensionAndWait"
64
+ ),
65
+ EndSuspension: "SessionCoordinator:EndSuspension",
66
+ EndSuspensionAndWait: transmit(
67
+ "SessionCoordinator:EndSuspensionAndWait"
68
+ ),
69
+ RemoteConnectReceived: "SessionCoordinator:RemoteConnectReceived",
70
+ RemoteSetTrackReceived: transmit(
71
+ "SessionCoordinator:RemoteSetTrackReceived"
72
+ ),
73
+ RemoteSetTrackDataReceived: transmit(
74
+ "SessionCoordinator:RemoteSetTrackDataReceived"
75
+ ),
76
+ RemotePlayReceived: transmit("SessionCoordinator:RemotePlayReceived"),
77
+ RemotePauseReceived: transmit("SessionCoordinator:RemotePauseReceived"),
78
+ RemoteSeekToReceived: transmit(
79
+ "SessionCoordinator:RemoteSeekToReceived"
80
+ ),
81
+ RemoteRateChangeReceived: transmit(
82
+ "SessionCoordinator:RemoteRateChangeReceived"
83
+ ),
84
+ PositionUpdateEventError: "SessionCoordinator:PositionUpdateEventError",
85
+ LiveObjectSynchronizerStartError:
86
+ "SessionCoordinator:LiveObjectSynchronizerStartError",
87
+ },
88
+ GroupCoordinator: {
89
+ TrackChanged: "GroupCoordinator:TrackChanged",
90
+ TrackChangeDelayed: "GroupCoordinator:TrackChangeDelayed",
91
+ TrackDataChanged: "GroupCoordinator:TrackDataChanged",
92
+ TrackDataChangeDelayed: "GroupCoordinator:TrackDataChangeDelayed",
93
+ TransportStateChanged: "GroupCoordinator:TransportStateChanged",
94
+ TransportStateChangeDelayed:
95
+ "GroupCoordinator:TransportStateChangeDelayed",
96
+ PlaybackRateChanged: "GroupCoordinator:PlaybackRateChanged",
97
+ PlaybackRateChangedDelayed: "GroupCoordinator:PlaybackRateChanged",
98
+ BeginSoftSuspension: "GroupCoordinator:BeginSoftSuspension",
99
+ CheckingForSyncIssues: "GroupCoordinator:CheckingForSyncIssues",
100
+ TrackOutOfSync: transmit("GroupCoordinator:TrackOutOfSync"),
101
+ TrackDataOutOfSync: transmit("GroupCoordinator:TrackDataOutOfSync"),
102
+ TransportOutOfSync: transmit("GroupCoordinator:TransportOutOfSync"),
103
+ PositionOutOfSync: transmit("GroupCoordinator:PositionOutOfSync"),
104
+ PlaybackRateOutOfSync: transmit(
105
+ "GroupCoordinator:PlaybackRateOutOfSync"
106
+ ),
107
+ },
108
+ };
109
+
110
+ /**
111
+ * @hidden
112
+ */
113
+ function transmit(eventName: string): string {
114
+ return `${eventName}#transmit`;
115
+ }