@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,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { MediaSessionCoordinatorSuspension, CoordinationWaitPoint } from './MediaSessionExtensions';
|
|
7
|
-
|
|
8
|
-
export class EphemeralMediaSessionCoordinatorSuspension implements MediaSessionCoordinatorSuspension {
|
|
9
|
-
private _waitPoint?: CoordinationWaitPoint;
|
|
10
|
-
private _onEnd: (seekTo?: number) => void;
|
|
11
|
-
|
|
12
|
-
constructor(waitPoint: CoordinationWaitPoint|undefined, onEnd: (seekTo?: number) => void) {
|
|
13
|
-
this._waitPoint = waitPoint;
|
|
14
|
-
this._onEnd = onEnd;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Returns an optional wait point associated with the suspension.
|
|
19
|
-
*/
|
|
20
|
-
public get waitPoint(): CoordinationWaitPoint|undefined {
|
|
21
|
-
return this._waitPoint;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Ends the suspension and optionally proposes a time to seek to.
|
|
26
|
-
* @param seekTo Optional. Proposed time to seek to. Ignored for suspensions at wait points.
|
|
27
|
-
*/
|
|
28
|
-
public end(seekTo?: number): void {
|
|
29
|
-
this._onEnd(seekTo);
|
|
30
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { MediaSessionCoordinatorSuspension, CoordinationWaitPoint } from './MediaSessionExtensions';
|
|
7
|
+
|
|
8
|
+
export class EphemeralMediaSessionCoordinatorSuspension implements MediaSessionCoordinatorSuspension {
|
|
9
|
+
private _waitPoint?: CoordinationWaitPoint;
|
|
10
|
+
private _onEnd: (seekTo?: number) => void;
|
|
11
|
+
|
|
12
|
+
constructor(waitPoint: CoordinationWaitPoint|undefined, onEnd: (seekTo?: number) => void) {
|
|
13
|
+
this._waitPoint = waitPoint;
|
|
14
|
+
this._onEnd = onEnd;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns an optional wait point associated with the suspension.
|
|
19
|
+
*/
|
|
20
|
+
public get waitPoint(): CoordinationWaitPoint|undefined {
|
|
21
|
+
return this._waitPoint;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Ends the suspension and optionally proposes a time to seek to.
|
|
26
|
+
* @param seekTo Optional. Proposed time to seek to. Ignored for suspensions at wait points.
|
|
27
|
+
*/
|
|
28
|
+
public end(seekTo?: number): void {
|
|
29
|
+
this._onEnd(seekTo);
|
|
30
|
+
}
|
|
31
31
|
}
|
package/src/IMediaPlayer.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface IMediaPlayer {
|
|
7
|
-
readonly currentSrc: string;
|
|
8
|
-
currentTime: number;
|
|
9
|
-
readonly duration: number;
|
|
10
|
-
readonly ended: boolean;
|
|
11
|
-
muted: boolean;
|
|
12
|
-
readonly paused: boolean;
|
|
13
|
-
playbackRate: number;
|
|
14
|
-
src: string;
|
|
15
|
-
volume: number;
|
|
16
|
-
load(): void;
|
|
17
|
-
pause(): void;
|
|
18
|
-
play(): Promise<void>;
|
|
19
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
20
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
21
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface IMediaPlayer {
|
|
7
|
+
readonly currentSrc: string;
|
|
8
|
+
currentTime: number;
|
|
9
|
+
readonly duration: number;
|
|
10
|
+
readonly ended: boolean;
|
|
11
|
+
muted: boolean;
|
|
12
|
+
readonly paused: boolean;
|
|
13
|
+
playbackRate: number;
|
|
14
|
+
src: string;
|
|
15
|
+
volume: number;
|
|
16
|
+
load(): void;
|
|
17
|
+
pause(): void;
|
|
18
|
+
play(): Promise<void>;
|
|
19
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
20
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
21
|
+
}
|