@microsoft/live-share-media 0.5.0-beta.4 → 0.5.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.
- package/.nycrc.json +10 -10
- package/LICENSE +86 -86
- package/README.md +137 -137
- package/package.json +38 -38
- package/src/EphemeralMediaSession.ts +248 -248
- package/src/EphemeralMediaSessionCoordinator.ts +461 -461
- package/src/EphemeralMediaSessionCoordinatorSuspension.ts +30 -30
- package/src/IMediaPlayer.ts +21 -21
- package/src/MediaPlayerSynchronizer.ts +449 -449
- package/src/MediaSessionActionThrottler.ts +14 -14
- package/src/MediaSessionExtensions.ts +42 -42
- package/src/RepeatedActionThrottler.ts +55 -55
- package/src/VolumeLimiter.ts +181 -181
- package/src/index.ts +15 -15
- package/src/internals/GroupCoordinatorState.ts +445 -445
- package/src/internals/GroupPlaybackPosition.ts +193 -193
- package/src/internals/GroupPlaybackTrack.ts +147 -147
- package/src/internals/GroupPlaybackTrackData.ts +90 -90
- package/src/internals/GroupTransportState.ts +127 -127
- package/src/internals/consts.ts +80 -80
- package/src/internals/index.ts +10 -10
- package/src/test/GroupPlaybackPosition.spec.ts +339 -339
- package/src/test/GroupPlaybackTrack.spec.ts +65 -65
- package/src/test/SharedMediaSession.spec.ts +113 -113
- package/src/test/SharedMediaSessionCoordinator.spec.ts +230 -230
- package/tsconfig.build.json +8 -8
- package/tsconfig.json +75 -75
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IEvent, EphemeralEvent } from '@microsoft/live-share';
|
|
7
|
-
import EventEmitter from 'events';
|
|
8
|
-
import { IMediaPlayerState } from '../EphemeralMediaSessionCoordinator';
|
|
9
|
-
import { ExtendedMediaSessionPlaybackState, ExtendedMediaSessionAction } from '../MediaSessionExtensions';
|
|
10
|
-
import { GroupPlaybackTrack, GroupPlaybackTrackEvents } from './GroupPlaybackTrack';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
export interface ITransportState {
|
|
17
|
-
playbackState: ExtendedMediaSessionPlaybackState;
|
|
18
|
-
startPosition: number;
|
|
19
|
-
timestamp: number;
|
|
20
|
-
clientId: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
export enum GroupTransportStateEvents {
|
|
27
|
-
transportStateChange = 'transportStateChange'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @hidden
|
|
32
|
-
*/
|
|
33
|
-
export interface ITransportStateChangeEvent extends IEvent {
|
|
34
|
-
action: ExtendedMediaSessionAction;
|
|
35
|
-
seekTime?: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
*/
|
|
41
|
-
export class GroupTransportState extends EventEmitter {
|
|
42
|
-
private readonly _getMediaPlayerState: () => IMediaPlayerState;
|
|
43
|
-
private _track: GroupPlaybackTrack;
|
|
44
|
-
private _current: ITransportState;
|
|
45
|
-
|
|
46
|
-
constructor(track: GroupPlaybackTrack, getMediaPlayerState: () => IMediaPlayerState) {
|
|
47
|
-
super();
|
|
48
|
-
this._getMediaPlayerState = getMediaPlayerState;
|
|
49
|
-
this._track = track;
|
|
50
|
-
this._current = {
|
|
51
|
-
playbackState: 'none',
|
|
52
|
-
startPosition: 0.0,
|
|
53
|
-
timestamp: 0,
|
|
54
|
-
clientId: ''
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// Listen for track changes
|
|
58
|
-
this._track.on(GroupPlaybackTrackEvents.trackChange, () => {
|
|
59
|
-
// Track changed so reset state to stopped ad position 0.0
|
|
60
|
-
this._current = {
|
|
61
|
-
playbackState: 'none',
|
|
62
|
-
startPosition: 0.0,
|
|
63
|
-
timestamp: this._track.current.timestamp,
|
|
64
|
-
clientId: this._track.current.clientId
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public get current(): Readonly<ITransportState> {
|
|
70
|
-
return this._current;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public get playbackState(): ExtendedMediaSessionPlaybackState {
|
|
74
|
-
return this.current.playbackState;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public get startPosition(): number {
|
|
78
|
-
return this.current.startPosition;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public get timestamp(): number {
|
|
82
|
-
return this.current.timestamp;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public get track(): GroupPlaybackTrack {
|
|
86
|
-
return this._track;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public compare(state: ITransportState): boolean {
|
|
90
|
-
return this.current.playbackState == state.playbackState && this.current.startPosition == state.startPosition;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public updateState(state: ITransportState): boolean {
|
|
94
|
-
// Ignore if same playback state and start position
|
|
95
|
-
if (this.compare(state)) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Ignore state changes that are older
|
|
100
|
-
const originalState = this.current;
|
|
101
|
-
if (state.timestamp < originalState.timestamp) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Ignore state changes that have the same timestamp and the clientId sorts higher.
|
|
106
|
-
if (state.timestamp == originalState.timestamp && state.clientId.localeCompare(originalState.clientId) > 0) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Update playback state
|
|
111
|
-
this._current = state;
|
|
112
|
-
|
|
113
|
-
// Trigger transport change
|
|
114
|
-
const playerState = this._getMediaPlayerState().playbackState;
|
|
115
|
-
if (originalState.playbackState == state.playbackState && playerState != 'ended') {
|
|
116
|
-
this.emit(GroupTransportStateEvents.transportStateChange, { type: GroupTransportStateEvents.transportStateChange, action: 'seekto', seekTime: state.startPosition });
|
|
117
|
-
} else if (state.playbackState == 'playing') {
|
|
118
|
-
const now = EphemeralEvent.getTimestamp();
|
|
119
|
-
const projectedPosition = state.startPosition + ((now - state.timestamp) / 1000);
|
|
120
|
-
this.emit(GroupTransportStateEvents.transportStateChange, { type: GroupTransportStateEvents.transportStateChange, action: 'play', seekTime: projectedPosition});
|
|
121
|
-
} else {
|
|
122
|
-
this.emit(GroupTransportStateEvents.transportStateChange, { type: GroupTransportStateEvents.transportStateChange, action: 'pause', seekTime: state.startPosition});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IEvent, EphemeralEvent } from '@microsoft/live-share';
|
|
7
|
+
import EventEmitter from 'events';
|
|
8
|
+
import { IMediaPlayerState } from '../EphemeralMediaSessionCoordinator';
|
|
9
|
+
import { ExtendedMediaSessionPlaybackState, ExtendedMediaSessionAction } from '../MediaSessionExtensions';
|
|
10
|
+
import { GroupPlaybackTrack, GroupPlaybackTrackEvents } from './GroupPlaybackTrack';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface ITransportState {
|
|
17
|
+
playbackState: ExtendedMediaSessionPlaybackState;
|
|
18
|
+
startPosition: number;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
clientId: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
export enum GroupTransportStateEvents {
|
|
27
|
+
transportStateChange = 'transportStateChange'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
export interface ITransportStateChangeEvent extends IEvent {
|
|
34
|
+
action: ExtendedMediaSessionAction;
|
|
35
|
+
seekTime?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
export class GroupTransportState extends EventEmitter {
|
|
42
|
+
private readonly _getMediaPlayerState: () => IMediaPlayerState;
|
|
43
|
+
private _track: GroupPlaybackTrack;
|
|
44
|
+
private _current: ITransportState;
|
|
45
|
+
|
|
46
|
+
constructor(track: GroupPlaybackTrack, getMediaPlayerState: () => IMediaPlayerState) {
|
|
47
|
+
super();
|
|
48
|
+
this._getMediaPlayerState = getMediaPlayerState;
|
|
49
|
+
this._track = track;
|
|
50
|
+
this._current = {
|
|
51
|
+
playbackState: 'none',
|
|
52
|
+
startPosition: 0.0,
|
|
53
|
+
timestamp: 0,
|
|
54
|
+
clientId: ''
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Listen for track changes
|
|
58
|
+
this._track.on(GroupPlaybackTrackEvents.trackChange, () => {
|
|
59
|
+
// Track changed so reset state to stopped ad position 0.0
|
|
60
|
+
this._current = {
|
|
61
|
+
playbackState: 'none',
|
|
62
|
+
startPosition: 0.0,
|
|
63
|
+
timestamp: this._track.current.timestamp,
|
|
64
|
+
clientId: this._track.current.clientId
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public get current(): Readonly<ITransportState> {
|
|
70
|
+
return this._current;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public get playbackState(): ExtendedMediaSessionPlaybackState {
|
|
74
|
+
return this.current.playbackState;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public get startPosition(): number {
|
|
78
|
+
return this.current.startPosition;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public get timestamp(): number {
|
|
82
|
+
return this.current.timestamp;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public get track(): GroupPlaybackTrack {
|
|
86
|
+
return this._track;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public compare(state: ITransportState): boolean {
|
|
90
|
+
return this.current.playbackState == state.playbackState && this.current.startPosition == state.startPosition;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public updateState(state: ITransportState): boolean {
|
|
94
|
+
// Ignore if same playback state and start position
|
|
95
|
+
if (this.compare(state)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Ignore state changes that are older
|
|
100
|
+
const originalState = this.current;
|
|
101
|
+
if (state.timestamp < originalState.timestamp) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Ignore state changes that have the same timestamp and the clientId sorts higher.
|
|
106
|
+
if (state.timestamp == originalState.timestamp && state.clientId.localeCompare(originalState.clientId) > 0) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Update playback state
|
|
111
|
+
this._current = state;
|
|
112
|
+
|
|
113
|
+
// Trigger transport change
|
|
114
|
+
const playerState = this._getMediaPlayerState().playbackState;
|
|
115
|
+
if (originalState.playbackState == state.playbackState && playerState != 'ended') {
|
|
116
|
+
this.emit(GroupTransportStateEvents.transportStateChange, { type: GroupTransportStateEvents.transportStateChange, action: 'seekto', seekTime: state.startPosition });
|
|
117
|
+
} else if (state.playbackState == 'playing') {
|
|
118
|
+
const now = EphemeralEvent.getTimestamp();
|
|
119
|
+
const projectedPosition = state.startPosition + ((now - state.timestamp) / 1000);
|
|
120
|
+
this.emit(GroupTransportStateEvents.transportStateChange, { type: GroupTransportStateEvents.transportStateChange, action: 'play', seekTime: projectedPosition});
|
|
121
|
+
} else {
|
|
122
|
+
this.emit(GroupTransportStateEvents.transportStateChange, { type: GroupTransportStateEvents.transportStateChange, action: 'pause', seekTime: state.startPosition});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
package/src/internals/consts.ts
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
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: 'MediaPlayerSynchronizer:SynchronizationStarted',
|
|
14
|
-
PlayerEvent: 'MediaPlayerSynchronizer:PlayerEvent',
|
|
15
|
-
PlayAction: 'MediaPlayerSynchronizer:PlayAction',
|
|
16
|
-
PauseAction: 'MediaPlayerSynchronizer:PauseAction',
|
|
17
|
-
SeekToAction: 'MediaPlayerSynchronizer:SeekToAction',
|
|
18
|
-
CatchupAction: 'MediaPlayerSynchronizer:CatchupAction',
|
|
19
|
-
SetTrackAction: 'MediaPlayerSynchronizer:SetTrackAction',
|
|
20
|
-
DataChangeAction: 'MediaPlayerSynchronizer:DataChangeAction',
|
|
21
|
-
UserTappedVideoToPlay: transmit('MediaPlayerSynchronizer:UserTappedVideoToPlay'),
|
|
22
|
-
PlaybackRateChangeBlocked: 'MediaPlayerSynchronizer:PlaybackRateChangeBlocked',
|
|
23
|
-
PlayerBlockedOperation: transmit('MediaPlayerSynchronizer:PlayerBlockedOperation'),
|
|
24
|
-
SeekingPlayerToStartPosition: 'MediaPlayerSynchronizer:SeekingPlayerToStartPosition',
|
|
25
|
-
BeginSeekCalled: 'MediaPlayerSynchronizer:BeginSeekCalled',
|
|
26
|
-
EndSeekCalled: 'MediaPlayerSynchronizer:EndSeekCalled',
|
|
27
|
-
PlayCalled: 'MediaPlayerSynchronizer:PlayCalled',
|
|
28
|
-
PauseCalled: 'MediaPlayerSynchronizer:PauseCalled',
|
|
29
|
-
SeekToCalled: 'MediaPlayerSynchronizer:SeekToCalled',
|
|
30
|
-
SetTrackCalled: 'MediaPlayerSynchronizer:SetTrackCalled',
|
|
31
|
-
SetTrackDataCalled: 'MediaPlayerSynchronizer:SetTrackDataCalled',
|
|
32
|
-
},
|
|
33
|
-
MediaSession: {
|
|
34
|
-
PlayAction: transmit('MediaSession:PlayAction'),
|
|
35
|
-
PauseAction: transmit('MediaSession:PauseAction'),
|
|
36
|
-
SeekToAction: transmit('MediaSession:SeekToAction'),
|
|
37
|
-
CatchUpAction: transmit('MediaSession:CatchUpAction'),
|
|
38
|
-
SetTrackAction: transmit('MediaSession:SetTrackAction'),
|
|
39
|
-
DataChangeAction: 'MediaSession:DataChangeAction',
|
|
40
|
-
BeginPositionUpdateTimer: 'MediaSession:BeginPositionUpdateTimer',
|
|
41
|
-
},
|
|
42
|
-
SessionCoordinator: {
|
|
43
|
-
PlayCalled: transmit('SessionCoordinator:PlayCalled'),
|
|
44
|
-
PauseCalled: transmit('SessionCoordinator:PauseCalled'),
|
|
45
|
-
SeekToCalled: transmit('SessionCoordinator:SeekToCalled'),
|
|
46
|
-
SetTrackCalled: transmit('SessionCoordinator:SetTrackCalled'),
|
|
47
|
-
SetTrackDataCalled: 'SessionCoordinator:SetTrackDataCalled',
|
|
48
|
-
BeginSuspension: 'SessionCoordinator:BeginSuspension',
|
|
49
|
-
BeginSuspensionAndWait: transmit('SessionCoordinator:BeginSuspensionAndWait'),
|
|
50
|
-
EndSuspension: 'SessionCoordinator:EndSuspension',
|
|
51
|
-
EndSuspensionAndWait: transmit('SessionCoordinator:EndSuspensionAndWait'),
|
|
52
|
-
RemoteJoinReceived: 'SessionCoordinator:RemoteJoinReceived',
|
|
53
|
-
RemoteSetTrackReceived: transmit('SessionCoordinator:RemoteSetTrackReceived'),
|
|
54
|
-
RemoteSetTrackDataReceived: transmit('SessionCoordinator:RemoteSetTrackDataReceived'),
|
|
55
|
-
RemotePlayReceived: transmit('SessionCoordinator:RemotePlayReceived'),
|
|
56
|
-
RemotePauseReceived: transmit('SessionCoordinator:RemotePauseReceived'),
|
|
57
|
-
RemoteSeekToReceived: transmit('SessionCoordinator:RemoteSeekToReceived'),
|
|
58
|
-
},
|
|
59
|
-
GroupCoordinator: {
|
|
60
|
-
TrackChanged: 'GroupCoordinator:TrackChanged',
|
|
61
|
-
TrackChangeDelayed: 'GroupCoordinator:TrackChangeDelayed',
|
|
62
|
-
TrackDataChanged: 'GroupCoordinator:TrackDataChanged',
|
|
63
|
-
TrackDataChangeDelayed: 'GroupCoordinator:TrackDataChangeDelayed',
|
|
64
|
-
TransportStateChanged: 'GroupCoordinator:TransportStateChanged',
|
|
65
|
-
TransportStateChangeDelayed: 'GroupCoordinator:TransportStateChangeDelayed',
|
|
66
|
-
BeginSoftSuspension: 'GroupCoordinator:BeginSoftSuspension',
|
|
67
|
-
CheckingForSyncIssues: 'GroupCoordinator:CheckingForSyncIssues',
|
|
68
|
-
TrackOutOfSync: transmit('GroupCoordinator:TrackOutOfSync'),
|
|
69
|
-
TrackDataOutOfSync: transmit('GroupCoordinator:TrackDataOutOfSync'),
|
|
70
|
-
TransportOutOfSync: transmit('GroupCoordinator:TransportOutOfSync'),
|
|
71
|
-
PositionOutOfSync: transmit('GroupCoordinator:PositionOutOfSync'),
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @hidden
|
|
77
|
-
*/
|
|
78
|
-
function transmit(eventName: string): string {
|
|
79
|
-
return `${eventName}#transmit`;
|
|
80
|
-
}
|
|
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: 'MediaPlayerSynchronizer:SynchronizationStarted',
|
|
14
|
+
PlayerEvent: 'MediaPlayerSynchronizer:PlayerEvent',
|
|
15
|
+
PlayAction: 'MediaPlayerSynchronizer:PlayAction',
|
|
16
|
+
PauseAction: 'MediaPlayerSynchronizer:PauseAction',
|
|
17
|
+
SeekToAction: 'MediaPlayerSynchronizer:SeekToAction',
|
|
18
|
+
CatchupAction: 'MediaPlayerSynchronizer:CatchupAction',
|
|
19
|
+
SetTrackAction: 'MediaPlayerSynchronizer:SetTrackAction',
|
|
20
|
+
DataChangeAction: 'MediaPlayerSynchronizer:DataChangeAction',
|
|
21
|
+
UserTappedVideoToPlay: transmit('MediaPlayerSynchronizer:UserTappedVideoToPlay'),
|
|
22
|
+
PlaybackRateChangeBlocked: 'MediaPlayerSynchronizer:PlaybackRateChangeBlocked',
|
|
23
|
+
PlayerBlockedOperation: transmit('MediaPlayerSynchronizer:PlayerBlockedOperation'),
|
|
24
|
+
SeekingPlayerToStartPosition: 'MediaPlayerSynchronizer:SeekingPlayerToStartPosition',
|
|
25
|
+
BeginSeekCalled: 'MediaPlayerSynchronizer:BeginSeekCalled',
|
|
26
|
+
EndSeekCalled: 'MediaPlayerSynchronizer:EndSeekCalled',
|
|
27
|
+
PlayCalled: 'MediaPlayerSynchronizer:PlayCalled',
|
|
28
|
+
PauseCalled: 'MediaPlayerSynchronizer:PauseCalled',
|
|
29
|
+
SeekToCalled: 'MediaPlayerSynchronizer:SeekToCalled',
|
|
30
|
+
SetTrackCalled: 'MediaPlayerSynchronizer:SetTrackCalled',
|
|
31
|
+
SetTrackDataCalled: 'MediaPlayerSynchronizer:SetTrackDataCalled',
|
|
32
|
+
},
|
|
33
|
+
MediaSession: {
|
|
34
|
+
PlayAction: transmit('MediaSession:PlayAction'),
|
|
35
|
+
PauseAction: transmit('MediaSession:PauseAction'),
|
|
36
|
+
SeekToAction: transmit('MediaSession:SeekToAction'),
|
|
37
|
+
CatchUpAction: transmit('MediaSession:CatchUpAction'),
|
|
38
|
+
SetTrackAction: transmit('MediaSession:SetTrackAction'),
|
|
39
|
+
DataChangeAction: 'MediaSession:DataChangeAction',
|
|
40
|
+
BeginPositionUpdateTimer: 'MediaSession:BeginPositionUpdateTimer',
|
|
41
|
+
},
|
|
42
|
+
SessionCoordinator: {
|
|
43
|
+
PlayCalled: transmit('SessionCoordinator:PlayCalled'),
|
|
44
|
+
PauseCalled: transmit('SessionCoordinator:PauseCalled'),
|
|
45
|
+
SeekToCalled: transmit('SessionCoordinator:SeekToCalled'),
|
|
46
|
+
SetTrackCalled: transmit('SessionCoordinator:SetTrackCalled'),
|
|
47
|
+
SetTrackDataCalled: 'SessionCoordinator:SetTrackDataCalled',
|
|
48
|
+
BeginSuspension: 'SessionCoordinator:BeginSuspension',
|
|
49
|
+
BeginSuspensionAndWait: transmit('SessionCoordinator:BeginSuspensionAndWait'),
|
|
50
|
+
EndSuspension: 'SessionCoordinator:EndSuspension',
|
|
51
|
+
EndSuspensionAndWait: transmit('SessionCoordinator:EndSuspensionAndWait'),
|
|
52
|
+
RemoteJoinReceived: 'SessionCoordinator:RemoteJoinReceived',
|
|
53
|
+
RemoteSetTrackReceived: transmit('SessionCoordinator:RemoteSetTrackReceived'),
|
|
54
|
+
RemoteSetTrackDataReceived: transmit('SessionCoordinator:RemoteSetTrackDataReceived'),
|
|
55
|
+
RemotePlayReceived: transmit('SessionCoordinator:RemotePlayReceived'),
|
|
56
|
+
RemotePauseReceived: transmit('SessionCoordinator:RemotePauseReceived'),
|
|
57
|
+
RemoteSeekToReceived: transmit('SessionCoordinator:RemoteSeekToReceived'),
|
|
58
|
+
},
|
|
59
|
+
GroupCoordinator: {
|
|
60
|
+
TrackChanged: 'GroupCoordinator:TrackChanged',
|
|
61
|
+
TrackChangeDelayed: 'GroupCoordinator:TrackChangeDelayed',
|
|
62
|
+
TrackDataChanged: 'GroupCoordinator:TrackDataChanged',
|
|
63
|
+
TrackDataChangeDelayed: 'GroupCoordinator:TrackDataChangeDelayed',
|
|
64
|
+
TransportStateChanged: 'GroupCoordinator:TransportStateChanged',
|
|
65
|
+
TransportStateChangeDelayed: 'GroupCoordinator:TransportStateChangeDelayed',
|
|
66
|
+
BeginSoftSuspension: 'GroupCoordinator:BeginSoftSuspension',
|
|
67
|
+
CheckingForSyncIssues: 'GroupCoordinator:CheckingForSyncIssues',
|
|
68
|
+
TrackOutOfSync: transmit('GroupCoordinator:TrackOutOfSync'),
|
|
69
|
+
TrackDataOutOfSync: transmit('GroupCoordinator:TrackDataOutOfSync'),
|
|
70
|
+
TransportOutOfSync: transmit('GroupCoordinator:TransportOutOfSync'),
|
|
71
|
+
PositionOutOfSync: transmit('GroupCoordinator:PositionOutOfSync'),
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @hidden
|
|
77
|
+
*/
|
|
78
|
+
function transmit(eventName: string): string {
|
|
79
|
+
return `${eventName}#transmit`;
|
|
80
|
+
}
|
package/src/internals/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export * from './consts';
|
|
7
|
-
export * from './GroupCoordinatorState';
|
|
8
|
-
export * from './GroupPlaybackPosition';
|
|
9
|
-
export * from './GroupPlaybackTrack';
|
|
10
|
-
export * from './GroupPlaybackTrackData';
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './consts';
|
|
7
|
+
export * from './GroupCoordinatorState';
|
|
8
|
+
export * from './GroupPlaybackPosition';
|
|
9
|
+
export * from './GroupPlaybackTrack';
|
|
10
|
+
export * from './GroupPlaybackTrackData';
|
|
11
11
|
export * from './GroupTransportState';
|