@microsoft/live-share-media 2.0.0-internal.1 → 2.0.0-internal.10
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/README.md +30 -31
- package/bin/cjs/IMediaPlayer.d.ts.map +1 -0
- package/bin/cjs/IMediaPlayer.js.map +1 -0
- package/bin/{LiveMediaSession.d.ts → cjs/LiveMediaSession.d.ts} +16 -9
- package/bin/cjs/LiveMediaSession.d.ts.map +1 -0
- package/bin/{LiveMediaSession.js → cjs/LiveMediaSession.js} +31 -25
- package/bin/cjs/LiveMediaSession.js.map +1 -0
- package/bin/{LiveMediaSessionCoordinator.d.ts → cjs/LiveMediaSessionCoordinator.d.ts} +57 -13
- package/bin/cjs/LiveMediaSessionCoordinator.d.ts.map +1 -0
- package/bin/{LiveMediaSessionCoordinator.js → cjs/LiveMediaSessionCoordinator.js} +152 -64
- package/bin/cjs/LiveMediaSessionCoordinator.js.map +1 -0
- package/bin/{LiveMediaSessionCoordinatorSuspension.d.ts → cjs/LiveMediaSessionCoordinatorSuspension.d.ts} +1 -1
- package/bin/cjs/LiveMediaSessionCoordinatorSuspension.d.ts.map +1 -0
- package/bin/cjs/LiveMediaSessionCoordinatorSuspension.js.map +1 -0
- package/bin/{MediaPlayerSynchronizer.d.ts → cjs/MediaPlayerSynchronizer.d.ts} +22 -8
- package/bin/cjs/MediaPlayerSynchronizer.d.ts.map +1 -0
- package/bin/{MediaPlayerSynchronizer.js → cjs/MediaPlayerSynchronizer.js} +38 -41
- package/bin/cjs/MediaPlayerSynchronizer.js.map +1 -0
- package/bin/{MediaSessionActionThrottler.d.ts → cjs/MediaSessionActionThrottler.d.ts} +1 -1
- package/bin/cjs/MediaSessionActionThrottler.d.ts.map +1 -0
- package/bin/cjs/MediaSessionActionThrottler.js.map +1 -0
- package/bin/cjs/MediaSessionExtensions.d.ts.map +1 -0
- package/bin/cjs/MediaSessionExtensions.js.map +1 -0
- package/bin/{RepeatedActionThrottler.d.ts → cjs/RepeatedActionThrottler.d.ts} +2 -2
- package/bin/cjs/RepeatedActionThrottler.d.ts.map +1 -0
- package/bin/{RepeatedActionThrottler.js → cjs/RepeatedActionThrottler.js} +2 -2
- package/bin/cjs/RepeatedActionThrottler.js.map +1 -0
- package/bin/{VolumeManager.d.ts → cjs/VolumeManager.d.ts} +6 -6
- package/bin/cjs/VolumeManager.d.ts.map +1 -0
- package/bin/{VolumeManager.js → cjs/VolumeManager.js} +5 -5
- 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/{internals → cjs}/index.js +9 -8
- package/bin/cjs/index.js.map +1 -0
- package/bin/{internals → cjs/internals}/GroupCoordinatorState.d.ts +14 -12
- package/bin/cjs/internals/GroupCoordinatorState.d.ts.map +1 -0
- package/bin/{internals → cjs/internals}/GroupCoordinatorState.js +46 -49
- package/bin/cjs/internals/GroupCoordinatorState.js.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackPosition.d.ts +6 -5
- package/bin/cjs/internals/GroupPlaybackPosition.d.ts.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackPosition.js +3 -3
- package/bin/cjs/internals/GroupPlaybackPosition.js.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackRate.d.ts +4 -5
- package/bin/cjs/internals/GroupPlaybackRate.d.ts.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackRate.js +2 -5
- package/bin/cjs/internals/GroupPlaybackRate.js.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackTrack.d.ts +5 -6
- package/bin/cjs/internals/GroupPlaybackTrack.d.ts.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackTrack.js +2 -5
- package/bin/cjs/internals/GroupPlaybackTrack.js.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackTrackData.d.ts +5 -6
- package/bin/cjs/internals/GroupPlaybackTrackData.d.ts.map +1 -0
- package/bin/{internals → cjs/internals}/GroupPlaybackTrackData.js +4 -7
- package/bin/cjs/internals/GroupPlaybackTrackData.js.map +1 -0
- package/bin/{internals → cjs/internals}/GroupTransportState.d.ts +8 -9
- package/bin/cjs/internals/GroupTransportState.d.ts.map +1 -0
- package/bin/{internals → cjs/internals}/GroupTransportState.js +4 -7
- 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.map +1 -0
- package/bin/cjs/internals/consts.js.map +1 -0
- package/bin/cjs/internals/errors.d.ts.map +1 -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/{internals → cjs/internals}/interfaces.js.map +1 -1
- 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/package.json +31 -12
- package/src/LiveMediaSession.ts +29 -14
- package/src/LiveMediaSessionCoordinator.ts +149 -37
- package/src/LiveMediaSessionCoordinatorSuspension.ts +1 -1
- package/src/MediaPlayerSynchronizer.ts +26 -11
- package/src/MediaSessionActionThrottler.ts +1 -1
- package/src/RepeatedActionThrottler.ts +2 -2
- package/src/VolumeManager.ts +6 -6
- package/src/index.ts +9 -9
- package/src/internals/GroupCoordinatorState.ts +19 -15
- package/src/internals/GroupPlaybackPosition.ts +9 -9
- package/src/internals/GroupPlaybackRate.ts +4 -4
- package/src/internals/GroupPlaybackTrack.ts +5 -5
- package/src/internals/GroupPlaybackTrackData.ts +5 -5
- package/src/internals/GroupTransportState.ts +8 -8
- package/src/internals/PriorityTimeInterval.ts +76 -0
- package/src/internals/interfaces.ts +15 -1
- package/tsconfig.cjs.json +14 -0
- package/tsconfig.json +65 -74
- package/.nycrc.json +0 -11
- package/bin/IMediaPlayer.d.ts.map +0 -1
- package/bin/IMediaPlayer.js.map +0 -1
- package/bin/LiveMediaSession.d.ts.map +0 -1
- package/bin/LiveMediaSession.js.map +0 -1
- package/bin/LiveMediaSessionCoordinator.d.ts.map +0 -1
- package/bin/LiveMediaSessionCoordinator.js.map +0 -1
- package/bin/LiveMediaSessionCoordinatorSuspension.d.ts.map +0 -1
- package/bin/LiveMediaSessionCoordinatorSuspension.js.map +0 -1
- package/bin/MediaPlayerSynchronizer.d.ts.map +0 -1
- package/bin/MediaPlayerSynchronizer.js.map +0 -1
- package/bin/MediaSessionActionThrottler.d.ts.map +0 -1
- package/bin/MediaSessionActionThrottler.js.map +0 -1
- package/bin/MediaSessionExtensions.d.ts.map +0 -1
- package/bin/MediaSessionExtensions.js.map +0 -1
- package/bin/RepeatedActionThrottler.d.ts.map +0 -1
- package/bin/RepeatedActionThrottler.js.map +0 -1
- package/bin/VolumeManager.d.ts.map +0 -1
- package/bin/VolumeManager.js.map +0 -1
- package/bin/index.d.ts +0 -14
- package/bin/index.d.ts.map +0 -1
- package/bin/index.js +0 -30
- package/bin/index.js.map +0 -1
- package/bin/internals/GroupCoordinatorState.d.ts.map +0 -1
- package/bin/internals/GroupCoordinatorState.js.map +0 -1
- package/bin/internals/GroupPlaybackPosition.d.ts.map +0 -1
- package/bin/internals/GroupPlaybackPosition.js.map +0 -1
- package/bin/internals/GroupPlaybackRate.d.ts.map +0 -1
- package/bin/internals/GroupPlaybackRate.js.map +0 -1
- package/bin/internals/GroupPlaybackTrack.d.ts.map +0 -1
- package/bin/internals/GroupPlaybackTrack.js.map +0 -1
- package/bin/internals/GroupPlaybackTrackData.d.ts.map +0 -1
- package/bin/internals/GroupPlaybackTrackData.js.map +0 -1
- package/bin/internals/GroupTransportState.d.ts.map +0 -1
- package/bin/internals/GroupTransportState.js.map +0 -1
- package/bin/internals/consts.d.ts.map +0 -1
- package/bin/internals/consts.js.map +0 -1
- package/bin/internals/errors.d.ts.map +0 -1
- package/bin/internals/errors.js.map +0 -1
- package/bin/internals/index.d.ts +0 -13
- package/bin/internals/index.d.ts.map +0 -1
- package/bin/internals/index.js.map +0 -1
- package/bin/internals/interfaces.d.ts +0 -10
- package/bin/internals/interfaces.d.ts.map +0 -1
- package/src/internals/index.ts +0 -13
- package/tsconfig.build.json +0 -9
- package/typedoc.json +0 -10
- /package/bin/{IMediaPlayer.d.ts → cjs/IMediaPlayer.d.ts} +0 -0
- /package/bin/{IMediaPlayer.js → cjs/IMediaPlayer.js} +0 -0
- /package/bin/{LiveMediaSessionCoordinatorSuspension.js → cjs/LiveMediaSessionCoordinatorSuspension.js} +0 -0
- /package/bin/{MediaSessionActionThrottler.js → cjs/MediaSessionActionThrottler.js} +0 -0
- /package/bin/{MediaSessionExtensions.d.ts → cjs/MediaSessionExtensions.d.ts} +0 -0
- /package/bin/{MediaSessionExtensions.js → cjs/MediaSessionExtensions.js} +0 -0
- /package/bin/{internals → cjs/internals}/consts.d.ts +0 -0
- /package/bin/{internals → cjs/internals}/consts.js +0 -0
- /package/bin/{internals → cjs/internals}/errors.d.ts +0 -0
- /package/bin/{internals → cjs/internals}/errors.js +0 -0
- /package/bin/{internals → cjs/internals}/interfaces.js +0 -0
package/README.md
CHANGED
|
@@ -35,15 +35,15 @@ This will use npm workspaces to hoist and build all dependencies.
|
|
|
35
35
|
|
|
36
36
|
```html
|
|
37
37
|
<body>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
<video id="player">
|
|
39
|
+
<source src="YOUR_VIDEO_SRC" type="video/mp4" />
|
|
40
|
+
</video>
|
|
41
|
+
<div class="player-controls">
|
|
42
|
+
<button id="play-button">Play</button>
|
|
43
|
+
<button id="pause-button">Pause</button>
|
|
44
|
+
<button id="restart-button">Restart</button>
|
|
45
|
+
<button id="change-track-button">Change track</button>
|
|
46
|
+
</div>
|
|
47
47
|
</body>
|
|
48
48
|
```
|
|
49
49
|
|
|
@@ -58,14 +58,12 @@ await microsoftTeams.app.initialize();
|
|
|
58
58
|
// Setup the Fluid container
|
|
59
59
|
const host = LiveShareHost.create();
|
|
60
60
|
const client = new LiveShareClient(host);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const { container } = await client.joinContainer(schema);
|
|
68
|
-
const { mediaSession } = container.initialObjects;
|
|
61
|
+
await client.join();
|
|
62
|
+
|
|
63
|
+
const mediaSession =
|
|
64
|
+
(await client.getDDS) <
|
|
65
|
+
LiveMediaSession >
|
|
66
|
+
("media-session-id", LiveMediaSession);
|
|
69
67
|
|
|
70
68
|
// Get the player from your document and create synchronizer
|
|
71
69
|
const player = document.getElementById("player");
|
|
@@ -78,21 +76,21 @@ await mediaSession.initialize(allowedRoles);
|
|
|
78
76
|
// Intercept user play, pause, seek, and set track actions through synchronizer
|
|
79
77
|
|
|
80
78
|
document.getElementById("play-button").onclick = () => {
|
|
81
|
-
|
|
79
|
+
synchronizer.play();
|
|
82
80
|
};
|
|
83
81
|
|
|
84
82
|
document.getElementById("pause-button").onclick = () => {
|
|
85
|
-
|
|
83
|
+
synchronizer.pause();
|
|
86
84
|
};
|
|
87
85
|
|
|
88
86
|
document.getElementById("restart-button").onclick = () => {
|
|
89
|
-
|
|
87
|
+
synchronizer.seekTo(0);
|
|
90
88
|
};
|
|
91
89
|
|
|
92
90
|
document.getElementById("change-track-button").onclick = () => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
synchronizer.setTrack({
|
|
92
|
+
trackIdentifier: "SOME_OTHER_VIDEO_SRC",
|
|
93
|
+
});
|
|
96
94
|
};
|
|
97
95
|
```
|
|
98
96
|
|
|
@@ -102,7 +100,7 @@ There are several code samples that are hosted in a separate GitHub repository.
|
|
|
102
100
|
|
|
103
101
|
| Sample name | Description | Javascript |
|
|
104
102
|
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
105
|
-
| React Video | Basic example showing how the LiveMediaSession object works with HTML5 video.
|
|
103
|
+
| React Video | Basic example showing how the LiveMediaSession object works with HTML5 video. | [View](https://aka.ms/liveshare-reactvideo) |
|
|
106
104
|
| React Media Template | Enable all connected clients to watch videos together, build a shared playlist, transfer whom is in control, and annotate over the video. | [View](https://aka.ms/liveshare-mediatemplate) |
|
|
107
105
|
|
|
108
106
|
## Package Compatibility
|
|
@@ -111,18 +109,19 @@ The Live Share SDK contains dependencies for [@microsoft/teams-js](https://www.n
|
|
|
111
109
|
|
|
112
110
|
**It is critical that your app use the package dependencies listed in the table below.** Lookup the version of the `@microsoft/live-share` you're using and set any other dependencies in your package.json file to match:
|
|
113
111
|
|
|
114
|
-
| @microsoft/live-share | @microsoft/teams-js
|
|
115
|
-
| --------------------- |
|
|
116
|
-
| ^
|
|
112
|
+
| @microsoft/live-share | @microsoft/teams-js | fluid-framework | @microsoft/live-share-\* | @fluidframework/azure-client | @microsoft/TeamsFx | @microsoft/TeamsFx-react |
|
|
113
|
+
| --------------------- | ------------------- | --------------- | ------------------------ | ---------------------------- | ------------------ | ------------------------ |
|
|
114
|
+
| ^2.0.0 | ^2.11.0 | ^2.0.0 | ^2.0.0 | ^2.0.0 | ^2.5.0 | ^2.5.0 |
|
|
115
|
+
| ^1.0.0 | ^2.11.0 | ^1.2.3 | ^1.0.0 | ^1.0.0 | ^2.5.0 | ^2.5.0 |
|
|
117
116
|
|
|
118
117
|
## Contributing
|
|
119
118
|
|
|
120
119
|
There are several ways you can [contribute](../../CONTRIBUTING.md) to this project:
|
|
121
120
|
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
121
|
+
- [Submit bugs](https://github.com/microsoft/live-share-sdk/issues) and help us verify fixes as they are checked in.
|
|
122
|
+
- Review the source code changes.
|
|
123
|
+
- Engage with other Live Share developers on [StackOverflow](https://stackoverflow.com/questions/tagged/live-share).
|
|
124
|
+
- [Contribute bug fixes](../../CONTRIBUTING.md).
|
|
126
125
|
|
|
127
126
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact <opencode@microsoft.com> with any additional questions or comments.
|
|
128
127
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMediaPlayer.d.ts","sourceRoot":"","sources":["../../src/IMediaPlayer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,gBAAgB,CACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC5C,IAAI,CAAC;IACR,mBAAmB,CACf,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACzC,IAAI,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMediaPlayer.js","sourceRoot":"","sources":["../../src/IMediaPlayer.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the Microsoft Live Share SDK License.
|
|
4
4
|
*/
|
|
5
|
-
import { DataObjectFactory } from "@fluidframework/aqueduct";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { DataObjectFactory } from "@fluidframework/aqueduct/legacy";
|
|
6
|
+
import { LiveTelemetryLogger, UserMeetingRole } from "@microsoft/live-share";
|
|
7
|
+
import { LiveDataObject } from "@microsoft/live-share/internal";
|
|
8
|
+
import { MediaPlayerSynchronizer } from "./MediaPlayerSynchronizer.js";
|
|
9
|
+
import { ExtendedMediaSessionAction, ExtendedMediaSessionActionHandler } from "./MediaSessionExtensions.js";
|
|
10
|
+
import { LiveMediaSessionCoordinator, IMediaPlayerState } from "./LiveMediaSessionCoordinator.js";
|
|
11
|
+
import { MediaSessionActionThrottler } from "./MediaSessionActionThrottler.js";
|
|
12
|
+
import { IMediaPlayer } from "./IMediaPlayer.js";
|
|
13
|
+
import { SharedObjectKind } from "fluid-framework";
|
|
12
14
|
/**
|
|
13
15
|
* Live fluid object that synchronizes media playback across multiple clients.
|
|
14
16
|
*/
|
|
15
|
-
export declare class
|
|
17
|
+
export declare class LiveMediaSessionClass extends LiveDataObject {
|
|
16
18
|
private _actionThrottler;
|
|
17
19
|
private _logger?;
|
|
18
20
|
private _requestPlayerStateHandler?;
|
|
@@ -28,7 +30,7 @@ export declare class LiveMediaSession extends LiveDataObject {
|
|
|
28
30
|
/**
|
|
29
31
|
* The objects fluid type factory.
|
|
30
32
|
*/
|
|
31
|
-
static readonly factory: DataObjectFactory<
|
|
33
|
+
static readonly factory: DataObjectFactory<LiveMediaSessionClass, import("@fluidframework/aqueduct/legacy").DataObjectTypes>;
|
|
32
34
|
/**
|
|
33
35
|
* Extension point that lets applications replace the default logic for throttling the sessions
|
|
34
36
|
* local sync behavior.
|
|
@@ -87,4 +89,9 @@ export declare class LiveMediaSession extends LiveDataObject {
|
|
|
87
89
|
private getCurrentPlayerState;
|
|
88
90
|
private dispatchAction;
|
|
89
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Live fluid object that synchronizes media playback across multiple clients.
|
|
94
|
+
*/
|
|
95
|
+
export type LiveMediaSession = LiveMediaSessionClass;
|
|
96
|
+
export declare const LiveMediaSession: typeof LiveMediaSessionClass & SharedObjectKind<LiveMediaSessionClass>;
|
|
90
97
|
//# sourceMappingURL=LiveMediaSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMediaSession.d.ts","sourceRoot":"","sources":["../../src/LiveMediaSession.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAGH,mBAAmB,EACnB,eAAe,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEH,cAAc,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAEH,0BAA0B,EAE1B,iCAAiC,EACpC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,2BAA2B,EAC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C,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,cAAc;CAQzB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAGrD,eAAO,MAAM,gBAAgB,wEAGzB,CAAC"}
|
|
@@ -13,21 +13,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.LiveMediaSession = void 0;
|
|
17
|
-
const
|
|
16
|
+
exports.LiveMediaSession = exports.LiveMediaSessionClass = void 0;
|
|
17
|
+
const legacy_1 = require("@fluidframework/aqueduct/legacy");
|
|
18
18
|
const live_share_1 = require("@microsoft/live-share");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
19
|
+
const internal_1 = require("@microsoft/live-share/internal");
|
|
20
|
+
const MediaPlayerSynchronizer_js_1 = require("./MediaPlayerSynchronizer.js");
|
|
21
|
+
const MediaSessionExtensions_js_1 = require("./MediaSessionExtensions.js");
|
|
22
|
+
const LiveMediaSessionCoordinator_js_1 = require("./LiveMediaSessionCoordinator.js");
|
|
23
|
+
const RepeatedActionThrottler_js_1 = require("./RepeatedActionThrottler.js");
|
|
24
|
+
const consts_js_1 = require("./internals/consts.js");
|
|
24
25
|
/**
|
|
25
26
|
* Live fluid object that synchronizes media playback across multiple clients.
|
|
26
27
|
*/
|
|
27
|
-
class
|
|
28
|
+
class LiveMediaSessionClass extends internal_1.LiveDataObject {
|
|
28
29
|
constructor() {
|
|
29
30
|
super(...arguments);
|
|
30
|
-
this._actionThrottler = new
|
|
31
|
+
this._actionThrottler = new RepeatedActionThrottler_js_1.RepeatedActionThrottler();
|
|
31
32
|
this._actionHandlers = new Map();
|
|
32
33
|
this._lastUpdateTime = 0;
|
|
33
34
|
}
|
|
@@ -127,7 +128,7 @@ class LiveMediaSession extends live_share_1.LiveDataObject {
|
|
|
127
128
|
}
|
|
128
129
|
// Start position update timer
|
|
129
130
|
if (!this._updateTimer) {
|
|
130
|
-
this.logger.sendTelemetryEvent(
|
|
131
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.BeginPositionUpdateTimer);
|
|
131
132
|
this._updateTimer = setInterval(() => {
|
|
132
133
|
// Get current state
|
|
133
134
|
const state = this.getCurrentPlayerState();
|
|
@@ -143,7 +144,7 @@ class LiveMediaSession extends live_share_1.LiveDataObject {
|
|
|
143
144
|
}
|
|
144
145
|
}, 500);
|
|
145
146
|
}
|
|
146
|
-
return new
|
|
147
|
+
return new MediaPlayerSynchronizer_js_1.MediaPlayerSynchronizer(player, this, this.runtime, () => {
|
|
147
148
|
this._synchronizing = undefined;
|
|
148
149
|
});
|
|
149
150
|
}
|
|
@@ -151,19 +152,19 @@ class LiveMediaSession extends live_share_1.LiveDataObject {
|
|
|
151
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
153
|
this._logger = new live_share_1.LiveTelemetryLogger(this.runtime, this.liveRuntime);
|
|
153
154
|
// Create coordinator and listen for triggered actions
|
|
154
|
-
this._coordinator = new
|
|
155
|
-
this._coordinator.on(
|
|
155
|
+
this._coordinator = new LiveMediaSessionCoordinator_js_1.LiveMediaSessionCoordinator(this.id, this.runtime, this.liveRuntime, () => this.getCurrentPlayerState());
|
|
156
|
+
this._coordinator.on(MediaSessionExtensions_js_1.MediaSessionCoordinatorEvents.triggeraction, (event) => {
|
|
156
157
|
// Pre-process actions
|
|
157
158
|
const details = event.details;
|
|
158
159
|
const seekTime = typeof details.seekTime == "number" ? details.seekTime : -1;
|
|
159
160
|
switch (details.action) {
|
|
160
161
|
case "play":
|
|
161
|
-
this.logger.sendTelemetryEvent(
|
|
162
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.PlayAction, null, {
|
|
162
163
|
position: seekTime,
|
|
163
164
|
});
|
|
164
165
|
break;
|
|
165
166
|
case "pause":
|
|
166
|
-
this.logger.sendTelemetryEvent(
|
|
167
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.PauseAction, null, {
|
|
167
168
|
position: seekTime,
|
|
168
169
|
});
|
|
169
170
|
break;
|
|
@@ -171,24 +172,24 @@ class LiveMediaSession extends live_share_1.LiveDataObject {
|
|
|
171
172
|
if (!details.playbackRate) {
|
|
172
173
|
break;
|
|
173
174
|
}
|
|
174
|
-
this.logger.sendTelemetryEvent(
|
|
175
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.RateChangeAction, null, {
|
|
175
176
|
playbackRate: details.playbackRate,
|
|
176
177
|
});
|
|
177
178
|
break;
|
|
178
179
|
case "seekto":
|
|
179
|
-
this.logger.sendTelemetryEvent(
|
|
180
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.SeekToAction, null, {
|
|
180
181
|
position: seekTime,
|
|
181
182
|
});
|
|
182
183
|
break;
|
|
183
184
|
case "settrack":
|
|
184
|
-
this.logger.sendTelemetryEvent(
|
|
185
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.SetTrackAction);
|
|
185
186
|
break;
|
|
186
187
|
case "datachange":
|
|
187
|
-
this.logger.sendTelemetryEvent(
|
|
188
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.DataChangeAction);
|
|
188
189
|
break;
|
|
189
190
|
case "catchup":
|
|
190
191
|
// Default to seekto if catchup not implemented
|
|
191
|
-
this.logger.sendTelemetryEvent(
|
|
192
|
+
this.logger.sendTelemetryEvent(consts_js_1.TelemetryEvents.MediaSession.CatchUpAction, null, {
|
|
192
193
|
position: seekTime,
|
|
193
194
|
});
|
|
194
195
|
if (!this._actionHandlers.has("catchup")) {
|
|
@@ -239,17 +240,22 @@ class LiveMediaSession extends live_share_1.LiveDataObject {
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
|
-
exports.
|
|
243
|
+
exports.LiveMediaSessionClass = LiveMediaSessionClass;
|
|
243
244
|
/**
|
|
244
245
|
* The objects fluid type name.
|
|
245
246
|
*/
|
|
246
|
-
|
|
247
|
+
LiveMediaSessionClass.TypeName = `@microsoft/fluid-media:SharedMediaSession`;
|
|
247
248
|
/**
|
|
248
249
|
* The objects fluid type factory.
|
|
249
250
|
*/
|
|
250
|
-
|
|
251
|
+
LiveMediaSessionClass.factory = new legacy_1.DataObjectFactory(LiveMediaSessionClass.TypeName, LiveMediaSessionClass, [], {});
|
|
252
|
+
// eslint-disable-next-line no-redeclare
|
|
253
|
+
exports.LiveMediaSession = (() => {
|
|
254
|
+
const kind = LiveMediaSessionClass;
|
|
255
|
+
return kind;
|
|
256
|
+
})();
|
|
251
257
|
/**
|
|
252
|
-
* Register `LiveMediaSession` as an available `
|
|
258
|
+
* Register `LiveMediaSession` as an available `SharedObjectKind` for use in dynamic object loading.
|
|
253
259
|
*/
|
|
254
|
-
|
|
260
|
+
internal_1.DynamicObjectRegistry.registerObjectClass(exports.LiveMediaSession, exports.LiveMediaSession.TypeName);
|
|
255
261
|
//# sourceMappingURL=LiveMediaSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMediaSession.js","sourceRoot":"","sources":["../../src/LiveMediaSession.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,4DAAoE;AACpE,sDAK+B;AAC/B,6DAGwC;AACxC,6EAAuE;AAEvE,2EAKqC;AACrC,qFAG0C;AAE1C,6EAAuE;AAGvE,qDAAwD;AAExD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,yBAAc;IAAzD;;QACY,qBAAgB,GACpB,IAAI,oDAAuB,EAAE,CAAC;QAIjB,oBAAe,GAG5B,IAAI,GAAG,EAAE,CAAC;QAKN,oBAAe,GAAW,CAAC,CAAC;IAqSxC,CAAC;IApRG;;;;;;;;;;;;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AAC3B,QAAA,gBAAgB,GAAG,CAAC,GAAG,EAAE;IAClC,MAAM,IAAI,GAAG,qBAAqB,CAAC;IACnC,OAAO,IAA6D,CAAC;AACzE,CAAC,CAAC,EAAE,CAAC;AAEL;;GAEG;AACH,gCAAqB,CAAC,mBAAmB,CACrC,wBAAgB,EAChB,wBAAgB,CAAC,QAAQ,CAC5B,CAAC"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the Microsoft Live Share SDK License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import { IRuntimeSignaler,
|
|
7
|
-
import { CoordinationWaitPoint, ExtendedMediaMetadata, ExtendedMediaSessionPlaybackState, MediaSessionCoordinatorSuspension } from "./MediaSessionExtensions";
|
|
8
|
-
import
|
|
5
|
+
import { UserMeetingRole } from "@microsoft/live-share";
|
|
6
|
+
import { IRuntimeSignaler, LiveShareRuntime } from "@microsoft/live-share/internal";
|
|
7
|
+
import { CoordinationWaitPoint, ExtendedMediaMetadata, ExtendedMediaSessionPlaybackState, MediaSessionCoordinatorSuspension } from "./MediaSessionExtensions.js";
|
|
8
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
9
|
+
import { IEvent } from "@fluidframework/core-interfaces";
|
|
9
10
|
/**
|
|
10
11
|
* Most recent state of the media session.
|
|
11
12
|
*/
|
|
@@ -30,12 +31,24 @@ export interface IMediaPlayerState {
|
|
|
30
31
|
*/
|
|
31
32
|
positionState?: MediaPositionState;
|
|
32
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface ILiveMediaSessionCoordinatorEvents extends IEvent {
|
|
38
|
+
/**
|
|
39
|
+
* Event listener for events emitted
|
|
40
|
+
* @param event update
|
|
41
|
+
* @param listener listener function
|
|
42
|
+
* @param listener.event the event instance
|
|
43
|
+
*/
|
|
44
|
+
(event: string, listener: (event: any) => void): void;
|
|
45
|
+
}
|
|
33
46
|
/**
|
|
34
47
|
* The `LiveMediaSessionCoordinator` tracks the playback & position state of all other
|
|
35
48
|
* clients being synchronized with. It is responsible for keeping the local media player
|
|
36
49
|
* in sync with the group.
|
|
37
50
|
*/
|
|
38
|
-
export declare class LiveMediaSessionCoordinator extends
|
|
51
|
+
export declare class LiveMediaSessionCoordinator extends TypedEventEmitter<ILiveMediaSessionCoordinatorEvents> {
|
|
39
52
|
private readonly _id;
|
|
40
53
|
private readonly _runtime;
|
|
41
54
|
private readonly _liveRuntime;
|
|
@@ -135,22 +148,45 @@ export declare class LiveMediaSessionCoordinator extends EventEmitter {
|
|
|
135
148
|
*/
|
|
136
149
|
get isSuspended(): boolean;
|
|
137
150
|
/**
|
|
138
|
-
*
|
|
151
|
+
* Controls whether or not to scale {@link maxPlaybackDrift} by the number of users in the session.
|
|
139
152
|
*
|
|
140
153
|
* @remarks
|
|
141
|
-
*
|
|
142
|
-
*
|
|
154
|
+
* As more clients join a session, it is more likely that some users will fall behind the presenter.
|
|
155
|
+
* It is also less likely that users will notice drift as more clients are added.
|
|
156
|
+
* It is usually helpful to be more lenient as more clients are added so everyone can watch all the content.
|
|
157
|
+
* Default value is true.
|
|
158
|
+
*/
|
|
159
|
+
get shouldScaleMaxPlaybackDrift(): boolean;
|
|
160
|
+
set shouldScaleMaxPlaybackDrift(value: boolean);
|
|
161
|
+
/**
|
|
162
|
+
* Max amount of playback drift allowed in seconds.
|
|
163
|
+
* This will scale automatically according to the number of participants in the session when {@link shouldScaleMaxPlaybackDrift} is true.
|
|
143
164
|
*
|
|
144
|
-
*
|
|
165
|
+
* @remarks
|
|
166
|
+
* Should the local clients playback position lag by more than the specified value, the coordinator will trigger a `catchup` action.
|
|
167
|
+
* Default value is `1.5` seconds.
|
|
145
168
|
*/
|
|
146
169
|
get maxPlaybackDrift(): number;
|
|
147
170
|
set maxPlaybackDrift(value: number);
|
|
148
171
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
172
|
+
* Controls whether or not to compute {@link positionUpdateInterval} based on whether user has initiated a playback command.
|
|
173
|
+
* Default value is true.
|
|
174
|
+
*
|
|
175
|
+
* @remarks
|
|
176
|
+
* When true, users that are simply watching but not controlling playback will report their positions less frequently.
|
|
177
|
+
* When a user has sent a transport command, they will begin sending position updates more frequently.
|
|
178
|
+
* Most Live Share apps have a concept of a primary presenter, and don't allow anyone to pause/play for the group.
|
|
179
|
+
* By ensuring only one/few users broadcast updates frequently, the server load is reduced considerably.
|
|
180
|
+
*/
|
|
181
|
+
get shouldScalePositionUpdateInterval(): boolean;
|
|
182
|
+
set shouldScalePositionUpdateInterval(value: boolean);
|
|
183
|
+
/**
|
|
184
|
+
* Frequency with which position updates are broadcast to the rest of the group in seconds.
|
|
185
|
+
* When {@link shouldScalePositionUpdateInterval} is set to `true`, the value set is the minimum value.
|
|
186
|
+
* The value returned is the actual value used to send updates by the local user, which may be larger than the value set.
|
|
151
187
|
*
|
|
152
188
|
* @remarks
|
|
153
|
-
* Defaults to a value of `2` seconds.
|
|
189
|
+
* Defaults to a minimum value of `2` seconds.
|
|
154
190
|
*/
|
|
155
191
|
get positionUpdateInterval(): number;
|
|
156
192
|
set positionUpdateInterval(value: number);
|
|
@@ -184,6 +220,14 @@ export declare class LiveMediaSessionCoordinator extends EventEmitter {
|
|
|
184
220
|
* @returns a void promise that resolves once complete, throws if user does not have proper roles
|
|
185
221
|
*/
|
|
186
222
|
seekTo(time: number): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Sets the playback rate for everyone in the session.
|
|
225
|
+
*
|
|
226
|
+
* @param playbackRate the playback rate to set.
|
|
227
|
+
*
|
|
228
|
+
* @throws
|
|
229
|
+
* Throws an exception if the session/coordinator hasn't been initialized or {@link canSetPlaybackRate} is false.
|
|
230
|
+
*/
|
|
187
231
|
setPlaybackRate(playbackRate: number): Promise<void>;
|
|
188
232
|
/**
|
|
189
233
|
* Instructs the group to load a new track.
|
|
@@ -253,7 +297,7 @@ export declare class LiveMediaSessionCoordinator extends EventEmitter {
|
|
|
253
297
|
* @hidden
|
|
254
298
|
* Called by MediaSession to trigger the sending of a position update.
|
|
255
299
|
*/
|
|
256
|
-
sendPositionUpdate(state: IMediaPlayerState): void;
|
|
300
|
+
sendPositionUpdate(state: IMediaPlayerState, targetClientId?: string): void;
|
|
257
301
|
protected createChildren(acceptTransportChangesFrom?: UserMeetingRole[]): Promise<void>;
|
|
258
302
|
private getPlayerPosition;
|
|
259
303
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMediaSessionCoordinator.d.ts","sourceRoot":"","sources":["../../src/LiveMediaSessionCoordinator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGH,eAAe,EAKlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,gBAAgB,EAIhB,gBAAgB,EAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,iCAAiC,EACpC,MAAM,6BAA6B,CAAC;AAiBrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAEvC;;;;;OAKG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,aAAa,EAAE,iCAAiC,CAAC;IAEjD;;OAEG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,kCAAmC,SAAQ,MAAM;IAC9D;;;;;OAKG;IACH,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CACzD;AAED;;;;GAIG;AACH,qBAAa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