@microsoft/live-share-media 2.0.0-internal.15 → 2.0.0-internal.16

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 (81) hide show
  1. package/bin/IMediaPlayer.d.ts +21 -0
  2. package/bin/IMediaPlayer.d.ts.map +1 -0
  3. package/bin/IMediaPlayer.js +7 -0
  4. package/bin/IMediaPlayer.js.map +1 -0
  5. package/bin/LiveMediaSession.d.ts +90 -0
  6. package/bin/LiveMediaSession.d.ts.map +1 -0
  7. package/bin/LiveMediaSession.js +255 -0
  8. package/bin/LiveMediaSession.js.map +1 -0
  9. package/bin/LiveMediaSessionCoordinator.d.ts +259 -0
  10. package/bin/LiveMediaSessionCoordinator.d.ts.map +1 -0
  11. package/bin/LiveMediaSessionCoordinator.js +472 -0
  12. package/bin/LiveMediaSessionCoordinator.js.map +1 -0
  13. package/bin/LiveMediaSessionCoordinatorSuspension.d.ts +20 -0
  14. package/bin/LiveMediaSessionCoordinatorSuspension.d.ts.map +1 -0
  15. package/bin/LiveMediaSessionCoordinatorSuspension.js +28 -0
  16. package/bin/LiveMediaSessionCoordinatorSuspension.js.map +1 -0
  17. package/bin/MediaPlayerSynchronizer.d.ts +189 -0
  18. package/bin/MediaPlayerSynchronizer.d.ts.map +1 -0
  19. package/bin/MediaPlayerSynchronizer.js +577 -0
  20. package/bin/MediaPlayerSynchronizer.js.map +1 -0
  21. package/bin/MediaSessionActionThrottler.d.ts +12 -0
  22. package/bin/MediaSessionActionThrottler.d.ts.map +1 -0
  23. package/bin/MediaSessionActionThrottler.js +14 -0
  24. package/bin/MediaSessionActionThrottler.js.map +1 -0
  25. package/bin/MediaSessionExtensions.d.ts +177 -0
  26. package/bin/MediaSessionExtensions.d.ts.map +1 -0
  27. package/bin/MediaSessionExtensions.js +26 -0
  28. package/bin/MediaSessionExtensions.js.map +1 -0
  29. package/bin/RepeatedActionThrottler.d.ts +20 -0
  30. package/bin/RepeatedActionThrottler.d.ts.map +1 -0
  31. package/bin/RepeatedActionThrottler.js +63 -0
  32. package/bin/RepeatedActionThrottler.js.map +1 -0
  33. package/bin/VolumeManager.d.ts +84 -0
  34. package/bin/VolumeManager.d.ts.map +1 -0
  35. package/bin/VolumeManager.js +175 -0
  36. package/bin/VolumeManager.js.map +1 -0
  37. package/bin/index.d.ts +14 -0
  38. package/bin/index.d.ts.map +1 -0
  39. package/bin/index.js +30 -0
  40. package/bin/index.js.map +1 -0
  41. package/bin/internals/GroupCoordinatorState.d.ts +107 -0
  42. package/bin/internals/GroupCoordinatorState.d.ts.map +1 -0
  43. package/bin/internals/GroupCoordinatorState.js +519 -0
  44. package/bin/internals/GroupCoordinatorState.js.map +1 -0
  45. package/bin/internals/GroupPlaybackPosition.d.ts +70 -0
  46. package/bin/internals/GroupPlaybackPosition.d.ts.map +1 -0
  47. package/bin/internals/GroupPlaybackPosition.js +170 -0
  48. package/bin/internals/GroupPlaybackPosition.js.map +1 -0
  49. package/bin/internals/GroupPlaybackRate.d.ts +38 -0
  50. package/bin/internals/GroupPlaybackRate.d.ts.map +1 -0
  51. package/bin/internals/GroupPlaybackRate.js +62 -0
  52. package/bin/internals/GroupPlaybackRate.js.map +1 -0
  53. package/bin/internals/GroupPlaybackTrack.d.ts +45 -0
  54. package/bin/internals/GroupPlaybackTrack.d.ts.map +1 -0
  55. package/bin/internals/GroupPlaybackTrack.js +125 -0
  56. package/bin/internals/GroupPlaybackTrack.js.map +1 -0
  57. package/bin/internals/GroupPlaybackTrackData.d.ts +40 -0
  58. package/bin/internals/GroupPlaybackTrackData.d.ts.map +1 -0
  59. package/bin/internals/GroupPlaybackTrackData.js +73 -0
  60. package/bin/internals/GroupPlaybackTrackData.js.map +1 -0
  61. package/bin/internals/GroupTransportState.d.ts +52 -0
  62. package/bin/internals/GroupTransportState.d.ts.map +1 -0
  63. package/bin/internals/GroupTransportState.js +123 -0
  64. package/bin/internals/GroupTransportState.js.map +1 -0
  65. package/bin/internals/consts.d.ts +83 -0
  66. package/bin/internals/consts.d.ts.map +1 -0
  67. package/bin/internals/consts.js +92 -0
  68. package/bin/internals/consts.js.map +1 -0
  69. package/bin/internals/errors.d.ts +17 -0
  70. package/bin/internals/errors.d.ts.map +1 -0
  71. package/bin/internals/errors.js +34 -0
  72. package/bin/internals/errors.js.map +1 -0
  73. package/bin/internals/index.d.ts +13 -0
  74. package/bin/internals/index.d.ts.map +1 -0
  75. package/bin/internals/index.js +29 -0
  76. package/bin/internals/index.js.map +1 -0
  77. package/bin/internals/interfaces.d.ts +10 -0
  78. package/bin/internals/interfaces.d.ts.map +1 -0
  79. package/bin/internals/interfaces.js +3 -0
  80. package/bin/internals/interfaces.js.map +1 -0
  81. package/package.json +3 -3
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+ import { ILiveEvent, IRuntimeSignaler } from "@microsoft/live-share";
6
+ import EventEmitter from "events";
7
+ import { ExtendedMediaMetadata, CoordinationWaitPoint, ExtendedMediaSessionActionDetails } from "./MediaSessionExtensions";
8
+ import { VolumeManager } from "./VolumeManager";
9
+ import { LiveMediaSession } from "./LiveMediaSession";
10
+ import { IMediaPlayer } from "./IMediaPlayer";
11
+ /**
12
+ * Event data returned by `MediaPlayerSynchronizer` object.
13
+ */
14
+ export interface IMediaPlayerSynchronizerEvent extends ILiveEvent {
15
+ /**
16
+ * Event details.
17
+ */
18
+ details: ExtendedMediaSessionActionDetails;
19
+ /**
20
+ * Action errors, including DOMException errors thrown by HTMLMediaElement
21
+ */
22
+ error?: Error;
23
+ }
24
+ /**
25
+ * Events supported by `MediaPlayerSynchronizer` object.
26
+ */
27
+ export declare enum MediaPlayerSynchronizerEvents {
28
+ /**
29
+ *
30
+ */
31
+ coordinatorstatechange = "coordinatorstatechange",
32
+ groupaction = "groupaction",
33
+ useraction = "useraction"
34
+ }
35
+ /**
36
+ * Synchronizes a local HTML Media Element with a group of remote HTML Media Elements.
37
+ *
38
+ * @remarks
39
+ * All of an apps transport control commands should be routed through the synchronizer. If the
40
+ * app is not currently joined to the group media session, the commands will be applied directly
41
+ * to the local player. When the group session is joined the commands will be broadcast to the
42
+ * group in addition to being applied to the local player.
43
+ */
44
+ export declare class MediaPlayerSynchronizer extends EventEmitter {
45
+ private static SESSION_ACTIONS;
46
+ private static PLAYER_EVENTS;
47
+ private _logger;
48
+ private _player;
49
+ private _mediaSession;
50
+ private _runtime;
51
+ private _volumeManager;
52
+ private _onEnd?;
53
+ private _onPlayerEvent;
54
+ private _seekSuspension?;
55
+ private _viewOnly;
56
+ private _blockUnexpectedPlayerEvents;
57
+ private _expectedPlaybackState;
58
+ private _expectedPlaybackRate;
59
+ private _metadata;
60
+ private _trackData;
61
+ /**
62
+ * Creates a new `MediaElementSynchronizer` instance.
63
+ * @param player Media player element. This can be an HTML Media Element or any player that looks like an HTML Media Element.
64
+ * @param mediaSession Group MediaSession object being used.
65
+ * @param onEnd Optional. Function to call when synchronizers `end()` method is called.
66
+ */
67
+ constructor(player: IMediaPlayer, mediaSession: LiveMediaSession, runtime: IRuntimeSignaler, onEnd: () => void);
68
+ /**
69
+ * Media player being synchronized.
70
+ */
71
+ get player(): IMediaPlayer;
72
+ /**
73
+ * Synchronizers media session.
74
+ */
75
+ get mediaSession(): LiveMediaSession;
76
+ /**
77
+ * If true the client is in a view only mode.
78
+ *
79
+ * @remarks
80
+ * Toggling this value to true results in `mediaSession.coordinator.canPlayPause`,
81
+ * `mediaSession.coordinator.canSeek`, `mediaSession.coordinator.canSetTrack`,
82
+ * `mediaSession.coordinator.canSetTrackData`, and `mediaSession.coordinator.canSetPlaybackRate`
83
+ * all being set to false. For more fine grained control over the local clients policies,
84
+ * call the `mediaSession.coordinator` directly.
85
+ */
86
+ get viewOnly(): boolean;
87
+ set viewOnly(value: boolean);
88
+ /**
89
+ * @beta
90
+ * If true, pause and play actions will be ignored unless explicitly invoked from the corresponding play() and pause() functions.
91
+ *
92
+ * @remarks
93
+ * True is considered non-beta. If you set to false, this is an experimental beta behavior.
94
+ * Setting it to false may cause unintended side effects, such as local buffer events sending a pause event to remote clients.
95
+ * While setting this to false may prevent the need to add custom media controls for frameworks like video.js, we encourage you to be mindful of this and test thoroughly before using this setting.
96
+ */
97
+ get blockUnexpectedPlayerEvents(): boolean;
98
+ set blockUnexpectedPlayerEvents(value: boolean);
99
+ /**
100
+ * Volume limiter used to temporarily reduce the videos volume when someone speaks in a meeting.
101
+ */
102
+ get volumeManager(): VolumeManager;
103
+ /**
104
+ * Registers a new event listener.
105
+ * @param event Name of the event to add.
106
+ * @param listener Function to call when the event is triggered.
107
+ */
108
+ addEventListener(event: MediaPlayerSynchronizerEvents, listener: (evt: IMediaPlayerSynchronizerEvent) => void): this;
109
+ /**
110
+ * Un-registers an existing event listener.
111
+ * @param event Name of the event to remove.
112
+ * @param listener Function that was registered in call to `addEventListener()`.
113
+ */
114
+ removeEventListener(event: MediaPlayerSynchronizerEvents, listener: (evt: IMediaPlayerSynchronizerEvent) => void): this;
115
+ /**
116
+ * Ends synchronization of the current media player.
117
+ */
118
+ end(): void;
119
+ /**
120
+ * Begin a local seek operation.
121
+ *
122
+ * @remarks
123
+ * UI can call this when a user grabs a timeline scrubber and starts scrubbing the video to a
124
+ * new playback position. The synchronizer will being a new suspension which temporarily
125
+ * disconnects the client for the rest of the group for synchronization purposes. Calling
126
+ * `endSeek()` will end the suspension and seek the group to the users final seek position.
127
+ */
128
+ beginSeek(): void;
129
+ /**
130
+ * Ends a seek operation that was started by calling `beginSeek()`.
131
+ * @param seekTo Playback position in seconds to seek the group to.
132
+ */
133
+ endSeek(seekTo: number): void;
134
+ /**
135
+ * Tells the group to begin playing the current video.
136
+ *
137
+ * @remarks
138
+ * For proper operation apps should avoid calling `mediaSession.coordinator.play()` directly
139
+ * and instead use the synchronizers `play()` method.
140
+ *
141
+ * @returns a void promise that resolves once complete, throws if user does not have proper roles
142
+ */
143
+ play(): Promise<void>;
144
+ /**
145
+ * Tells the group to pause the current video.
146
+ *
147
+ * @remarks
148
+ * For proper operation apps should avoid calling `mediaSession.coordinator.pause()` directly
149
+ * and instead use the synchronizers `pause()` method.
150
+ *
151
+ * @returns a void promise that resolves once complete, throws if user does not have proper roles
152
+ */
153
+ pause(): Promise<void>;
154
+ /**
155
+ * Tells the group to seek the current video to a new playback position.
156
+ *
157
+ * @remarks
158
+ * For proper operation apps should avoid calling `mediaSession.coordinator.seekTo()` directly
159
+ * and instead use the synchronizers `seekTo()` method.
160
+ *
161
+ * @returns a void promise that resolves once complete, throws if user does not have proper roles
162
+ */
163
+ seekTo(time: number): Promise<void>;
164
+ setPlaybackRate(playbackRate: number): Promise<void>;
165
+ /**
166
+ * Tells the group to change to a new track.
167
+ *
168
+ * @remarks
169
+ * For proper operation apps should avoid calling `mediaSession.coordinator.setTrack()` directly
170
+ * and instead use the synchronizers `setTrack()` method.
171
+ *
172
+ * @returns a void promise that resolves once complete, throws if user does not have proper roles
173
+ */
174
+ setTrack(track: ExtendedMediaMetadata, waitPoints?: CoordinationWaitPoint[]): Promise<void>;
175
+ /**
176
+ * Updates the current tracks data object.
177
+ *
178
+ * @remarks
179
+ * For proper operation apps should avoid calling `mediaSession.coordinator.setTrackData()` directly
180
+ * and instead use the synchronizers `setTrackData()` method.
181
+ *
182
+ * @returns a void promise that resolves once complete, throws if user does not have proper roles
183
+ */
184
+ setTrackData(data: object | null): Promise<void>;
185
+ private dispatchGroupAction;
186
+ private dispatchUserAction;
187
+ private catchupPlayer;
188
+ }
189
+ //# sourceMappingURL=MediaPlayerSynchronizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaPlayerSynchronizer.d.ts","sourceRoot":"","sources":["../src/MediaPlayerSynchronizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEH,UAAU,EACV,gBAAgB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAGH,qBA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