@microsoft/live-share-media 1.0.0-preview.1 → 1.0.0-preview.11

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 (111) hide show
  1. package/README.md +15 -13
  2. package/package.json +11 -9
  3. package/src/IMediaPlayer.ts +10 -2
  4. package/src/LiveMediaSession.ts +138 -71
  5. package/src/LiveMediaSessionCoordinator.ts +302 -142
  6. package/src/LiveMediaSessionCoordinatorSuspension.ts +13 -5
  7. package/src/MediaPlayerSynchronizer.ts +329 -149
  8. package/src/MediaSessionActionThrottler.ts +5 -3
  9. package/src/MediaSessionExtensions.ts +15 -5
  10. package/src/RepeatedActionThrottler.ts +27 -9
  11. package/src/VolumeManager.ts +24 -12
  12. package/src/index.ts +9 -10
  13. package/src/internals/GroupCoordinatorState.ts +275 -114
  14. package/src/internals/GroupPlaybackPosition.ts +63 -29
  15. package/src/internals/GroupPlaybackTrack.ts +51 -22
  16. package/src/internals/GroupPlaybackTrackData.ts +24 -16
  17. package/src/internals/GroupTransportState.ts +54 -24
  18. package/src/internals/consts.ts +73 -55
  19. package/src/internals/index.ts +6 -6
  20. package/src/test/GroupPlaybackPosition.spec.ts +371 -111
  21. package/src/test/GroupPlaybackTrack.spec.ts +91 -35
  22. package/src/test/SharedMediaSession.spec.ts +64 -28
  23. package/src/test/SharedMediaSessionCoordinator.spec.ts +86 -46
  24. package/src/test/VolumeManager.spec.ts +38 -31
  25. package/tsconfig.json +1 -0
  26. package/.vscode/launch.json +0 -29
  27. package/.vscode/settings.json +0 -2
  28. package/bin/EphemeralMediaSession.d.ts +0 -102
  29. package/bin/EphemeralMediaSession.d.ts.map +0 -1
  30. package/bin/EphemeralMediaSession.js +0 -226
  31. package/bin/EphemeralMediaSession.js.map +0 -1
  32. package/bin/EphemeralMediaSessionCoordinator.d.ts +0 -228
  33. package/bin/EphemeralMediaSessionCoordinator.d.ts.map +0 -1
  34. package/bin/EphemeralMediaSessionCoordinator.js +0 -396
  35. package/bin/EphemeralMediaSessionCoordinator.js.map +0 -1
  36. package/bin/EphemeralMediaSessionCoordinatorSuspension.d.ts +0 -20
  37. package/bin/EphemeralMediaSessionCoordinatorSuspension.d.ts.map +0 -1
  38. package/bin/EphemeralMediaSessionCoordinatorSuspension.js +0 -28
  39. package/bin/EphemeralMediaSessionCoordinatorSuspension.js.map +0 -1
  40. package/bin/IMediaPlayer.d.ts +0 -21
  41. package/bin/IMediaPlayer.d.ts.map +0 -1
  42. package/bin/IMediaPlayer.js +0 -7
  43. package/bin/IMediaPlayer.js.map +0 -1
  44. package/bin/LiveMediaSession.d.ts +0 -95
  45. package/bin/LiveMediaSession.d.ts.map +0 -1
  46. package/bin/LiveMediaSession.js +0 -217
  47. package/bin/LiveMediaSession.js.map +0 -1
  48. package/bin/LiveMediaSessionCoordinator.d.ts +0 -228
  49. package/bin/LiveMediaSessionCoordinator.d.ts.map +0 -1
  50. package/bin/LiveMediaSessionCoordinator.js +0 -396
  51. package/bin/LiveMediaSessionCoordinator.js.map +0 -1
  52. package/bin/LiveMediaSessionCoordinatorSuspension.d.ts +0 -20
  53. package/bin/LiveMediaSessionCoordinatorSuspension.d.ts.map +0 -1
  54. package/bin/LiveMediaSessionCoordinatorSuspension.js +0 -28
  55. package/bin/LiveMediaSessionCoordinatorSuspension.js.map +0 -1
  56. package/bin/MediaPlayerSynchronizer.d.ts +0 -164
  57. package/bin/MediaPlayerSynchronizer.d.ts.map +0 -1
  58. package/bin/MediaPlayerSynchronizer.js +0 -414
  59. package/bin/MediaPlayerSynchronizer.js.map +0 -1
  60. package/bin/MediaSessionActionThrottler.d.ts +0 -12
  61. package/bin/MediaSessionActionThrottler.d.ts.map +0 -1
  62. package/bin/MediaSessionActionThrottler.js +0 -14
  63. package/bin/MediaSessionActionThrottler.js.map +0 -1
  64. package/bin/MediaSessionExtensions.d.ts +0 -35
  65. package/bin/MediaSessionExtensions.d.ts.map +0 -1
  66. package/bin/MediaSessionExtensions.js +0 -13
  67. package/bin/MediaSessionExtensions.js.map +0 -1
  68. package/bin/RepeatedActionThrottler.d.ts +0 -20
  69. package/bin/RepeatedActionThrottler.d.ts.map +0 -1
  70. package/bin/RepeatedActionThrottler.js +0 -57
  71. package/bin/RepeatedActionThrottler.js.map +0 -1
  72. package/bin/VolumeLimiter.d.ts +0 -70
  73. package/bin/VolumeLimiter.d.ts.map +0 -1
  74. package/bin/VolumeLimiter.js +0 -170
  75. package/bin/VolumeLimiter.js.map +0 -1
  76. package/bin/VolumeManager.d.ts +0 -84
  77. package/bin/VolumeManager.d.ts.map +0 -1
  78. package/bin/VolumeManager.js +0 -173
  79. package/bin/VolumeManager.js.map +0 -1
  80. package/bin/index.d.ts +0 -14
  81. package/bin/index.d.ts.map +0 -1
  82. package/bin/index.js +0 -30
  83. package/bin/index.js.map +0 -1
  84. package/bin/internals/GroupCoordinatorState.d.ts +0 -93
  85. package/bin/internals/GroupCoordinatorState.d.ts.map +0 -1
  86. package/bin/internals/GroupCoordinatorState.js +0 -367
  87. package/bin/internals/GroupCoordinatorState.js.map +0 -1
  88. package/bin/internals/GroupPlaybackPosition.d.ts +0 -67
  89. package/bin/internals/GroupPlaybackPosition.d.ts.map +0 -1
  90. package/bin/internals/GroupPlaybackPosition.js +0 -158
  91. package/bin/internals/GroupPlaybackPosition.js.map +0 -1
  92. package/bin/internals/GroupPlaybackTrack.d.ts +0 -46
  93. package/bin/internals/GroupPlaybackTrack.d.ts.map +0 -1
  94. package/bin/internals/GroupPlaybackTrack.js +0 -112
  95. package/bin/internals/GroupPlaybackTrack.js.map +0 -1
  96. package/bin/internals/GroupPlaybackTrackData.d.ts +0 -40
  97. package/bin/internals/GroupPlaybackTrackData.d.ts.map +0 -1
  98. package/bin/internals/GroupPlaybackTrackData.js +0 -66
  99. package/bin/internals/GroupPlaybackTrackData.js.map +0 -1
  100. package/bin/internals/GroupTransportState.d.ts +0 -49
  101. package/bin/internals/GroupTransportState.d.ts.map +0 -1
  102. package/bin/internals/GroupTransportState.js +0 -97
  103. package/bin/internals/GroupTransportState.js.map +0 -1
  104. package/bin/internals/consts.d.ts +0 -73
  105. package/bin/internals/consts.d.ts.map +0 -1
  106. package/bin/internals/consts.js +0 -82
  107. package/bin/internals/consts.js.map +0 -1
  108. package/bin/internals/index.d.ts +0 -11
  109. package/bin/internals/index.d.ts.map +0 -1
  110. package/bin/internals/index.js +0 -27
  111. package/bin/internals/index.js.map +0 -1
@@ -1,70 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { IMediaPlayer } from './IMediaPlayer';
6
- export declare enum LevelType {
7
- fixed = 0,
8
- percentage = 1
9
- }
10
- export declare class VolumeLimiter {
11
- private readonly _player;
12
- private readonly _duration;
13
- private readonly _rampDownDuration;
14
- private readonly _rampUpDuration;
15
- private _level;
16
- private _levelType;
17
- private _running;
18
- private _endTime;
19
- private _startTime;
20
- private _startVolume;
21
- private _inRamp;
22
- constructor(player: IMediaPlayer);
23
- /**
24
- * Time, in seconds, that the volume should be lowered.
25
- *
26
- * @remarks
27
- * Applications should periodically call `lowerVolume()` to keep the volume lowered.
28
- */
29
- get duration(): number;
30
- set duration(value: number);
31
- /**
32
- * Target level to lower volume to.
33
- *
34
- * @remarks
35
- * Expressed as a value between 0.0 and 1.0. The value is applied based upon the configured
36
- * `levelType`. The default value is 0.2.
37
- *
38
- * For a level type of `LevelType.fixed` the value is the exact level the volume will be
39
- * lowered to. The default value of 0.2 would cause the volume to be lowered to 0.2.
40
- *
41
- * For a level type of `LevelType.percentage` the value is the percentage by which the volume
42
- * level should be lowered to. The default value of 0.2 would cause the volume to be lowered
43
- * to 20% of its starting value.
44
- */
45
- get level(): number;
46
- set level(value: number);
47
- /**
48
- * The type of level represented by the `level` property.
49
- */
50
- get levelType(): LevelType;
51
- set levelType(value: LevelType);
52
- /**
53
- * Amount of time, in seconds, it should take to ramp the volume down to the desired level.
54
- */
55
- get rampDownDuration(): number;
56
- set rampDownDuration(value: number);
57
- /**
58
- * Amount of time, in seconds, it should take to ramp the volume back up to the original level.
59
- */
60
- get rampUpDuration(): number;
61
- set rampUpDuration(value: number);
62
- /**
63
- * Temporarily lowers an audio sources volume.
64
- */
65
- lowerVolume(): void;
66
- private startLimiter;
67
- private scheduleAnimationFrame;
68
- private computeTargetVolume;
69
- }
70
- //# sourceMappingURL=VolumeLimiter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VolumeLimiter.d.ts","sourceRoot":"","sources":["../src/VolumeLimiter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/C,oBAAY,SAAS;IAAG,KAAK,IAAA;IAAE,UAAU,IAAA;CAAE;AAE3C,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IAGvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAyB;IAC3D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IACzD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,UAAU,CAA8B;IAGhD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,YAAY;IAIhC;;;;;OAKG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEhC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED,IAAW,KAAK,CAAC,KAAK,EAAE,MAAM,EAM7B;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,SAAS,CAEhC;IAED,IAAW,SAAS,CAAC,KAAK,EAAE,SAAS,EAEpC;IAED;;OAEG;IACH,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAED,IAAW,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAExC;IAED;;OAEG;IACF,IAAW,cAAc,IAAI,MAAM,CAEnC;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,MAAM,EAEtC;IAED;;OAEG;IACI,WAAW,IAAI,IAAI;IAO1B,OAAO,CAAC,YAAY;IAkDpB,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,mBAAmB;CAS9B"}
@@ -1,170 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the Microsoft Live Share SDK License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.VolumeLimiter = exports.LevelType = void 0;
8
- const live_share_1 = require("@microsoft/live-share");
9
- var LevelType;
10
- (function (LevelType) {
11
- LevelType[LevelType["fixed"] = 0] = "fixed";
12
- LevelType[LevelType["percentage"] = 1] = "percentage";
13
- })(LevelType = exports.LevelType || (exports.LevelType = {}));
14
- class VolumeLimiter {
15
- constructor(player) {
16
- // Settings
17
- this._duration = new live_share_1.TimeInterval(2000);
18
- this._rampDownDuration = new live_share_1.TimeInterval(500);
19
- this._rampUpDuration = new live_share_1.TimeInterval(500);
20
- this._level = 0.1;
21
- this._levelType = LevelType.fixed;
22
- // Running state
23
- this._running = false;
24
- this._endTime = 0;
25
- this._startTime = 0;
26
- this._startVolume = 0;
27
- this._inRamp = false;
28
- this._player = player;
29
- }
30
- /**
31
- * Time, in seconds, that the volume should be lowered.
32
- *
33
- * @remarks
34
- * Applications should periodically call `lowerVolume()` to keep the volume lowered.
35
- */
36
- get duration() {
37
- return this._duration.seconds;
38
- }
39
- set duration(value) {
40
- this._duration.seconds = Math.abs(value);
41
- }
42
- /**
43
- * Target level to lower volume to.
44
- *
45
- * @remarks
46
- * Expressed as a value between 0.0 and 1.0. The value is applied based upon the configured
47
- * `levelType`. The default value is 0.2.
48
- *
49
- * For a level type of `LevelType.fixed` the value is the exact level the volume will be
50
- * lowered to. The default value of 0.2 would cause the volume to be lowered to 0.2.
51
- *
52
- * For a level type of `LevelType.percentage` the value is the percentage by which the volume
53
- * level should be lowered to. The default value of 0.2 would cause the volume to be lowered
54
- * to 20% of its starting value.
55
- */
56
- get level() {
57
- return this._level;
58
- }
59
- set level(value) {
60
- if (value < 0 || value > 1.0) {
61
- throw new Error(`VolumeLimiter: cannot set level to ${value}. Level must be between 0.0 and 1.0.`);
62
- }
63
- this._level = value;
64
- }
65
- /**
66
- * The type of level represented by the `level` property.
67
- */
68
- get levelType() {
69
- return this._levelType;
70
- }
71
- set levelType(value) {
72
- this._levelType = value;
73
- }
74
- /**
75
- * Amount of time, in seconds, it should take to ramp the volume down to the desired level.
76
- */
77
- get rampDownDuration() {
78
- return this._rampDownDuration.seconds;
79
- }
80
- set rampDownDuration(value) {
81
- this._rampDownDuration.seconds = Math.abs(value);
82
- }
83
- /**
84
- * Amount of time, in seconds, it should take to ramp the volume back up to the original level.
85
- */
86
- get rampUpDuration() {
87
- return this._rampUpDuration.seconds;
88
- }
89
- set rampUpDuration(value) {
90
- this._rampUpDuration.seconds = Math.abs(value);
91
- }
92
- /**
93
- * Temporarily lowers an audio sources volume.
94
- */
95
- lowerVolume() {
96
- this._endTime = new Date().getTime() + this._duration.milliseconds;
97
- if (!this._running) {
98
- this.startLimiter();
99
- }
100
- }
101
- startLimiter() {
102
- const adjustVolume = () => {
103
- const now = new Date().getTime();
104
- if (now < this._endTime) {
105
- // Make no adjustment if muted
106
- if (!this._player.muted) {
107
- // Compute adjusted volume level
108
- let volume;
109
- const targetVolume = this.computeTargetVolume();
110
- const rampRange = this._startVolume - targetVolume;
111
- const rampUpStart = this._endTime - this._rampUpDuration.milliseconds;
112
- const rampDownEnd = this._startTime + this._rampDownDuration.milliseconds;
113
- if (now > rampUpStart) {
114
- // We're about to end so ramping up
115
- const progress = (now - rampUpStart) / this._rampUpDuration.milliseconds;
116
- volume = targetVolume + (rampRange * progress);
117
- this._player.volume = volume;
118
- this._inRamp = true;
119
- }
120
- else if (now < rampDownEnd) {
121
- // We just begun so ramping down
122
- const remaining = (rampDownEnd - now) / this._rampUpDuration.milliseconds;
123
- volume = targetVolume + (rampRange * remaining);
124
- this._player.volume = volume;
125
- this._inRamp = true;
126
- }
127
- else if (this._inRamp) {
128
- // We're at the end of a ramp
129
- volume = targetVolume;
130
- this._player.volume = volume;
131
- this._inRamp = false;
132
- }
133
- }
134
- // Schedule next animation frame
135
- this.scheduleAnimationFrame(adjustVolume);
136
- }
137
- else {
138
- // Reset volume to original level
139
- this._player.volume = this._startVolume;
140
- this._running = false;
141
- this._endTime = 0;
142
- this._startTime = 0;
143
- this._startVolume = 0;
144
- }
145
- };
146
- this._running = true;
147
- this._startTime = new Date().getTime();
148
- this._startVolume = this._player.volume;
149
- this.scheduleAnimationFrame(adjustVolume);
150
- }
151
- scheduleAnimationFrame(callback) {
152
- if (requestAnimationFrame) {
153
- requestAnimationFrame(callback);
154
- }
155
- else {
156
- setTimeout(callback, 20);
157
- }
158
- }
159
- computeTargetVolume() {
160
- switch (this._levelType) {
161
- case LevelType.percentage:
162
- return this._startVolume * this._level;
163
- case LevelType.fixed:
164
- default:
165
- return this._level;
166
- }
167
- }
168
- }
169
- exports.VolumeLimiter = VolumeLimiter;
170
- //# sourceMappingURL=VolumeLimiter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VolumeLimiter.js","sourceRoot":"","sources":["../src/VolumeLimiter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEF,sDAAqD;AAGtD,IAAY,SAA+B;AAA3C,WAAY,SAAS;IAAG,2CAAK,CAAA;IAAE,qDAAU,CAAA;AAAC,CAAC,EAA/B,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAAsB;AAE3C,MAAa,aAAa;IAiBtB,YAAY,MAAoB;QAdhC,WAAW;QACM,cAAS,GAAG,IAAI,yBAAY,CAAC,IAAI,CAAC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YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACxC,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;IAEO,sBAAsB,CAAC,QAA8B;QACzD,IAAI,qBAAqB,EAAE;YACvB,qBAAqB,CAAC,QAAQ,CAAC,CAAC;SACnC;aAAM;YACH,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SAC5B;IACL,CAAC;IAEO,mBAAmB;QACvB,QAAQ,IAAI,CAAC,UAAU,EAAE;YACrB,KAAK,SAAS,CAAC,UAAU;gBACrB,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3C,KAAK,SAAS,CAAC,KAAK,CAAC;YACrB;gBACI,OAAO,IAAI,CAAC,MAAM,CAAC;SAC1B;IACL,CAAC;CACJ;AA3KD,sCA2KC"}
@@ -1,84 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { IMediaPlayer } from './IMediaPlayer';
6
- export declare enum LimitLevelType {
7
- fixed = 0,
8
- percentage = 1
9
- }
10
- /**
11
- * Smooth audio level changes when volume is modified, or if volume limiting has started/ended.
12
- */
13
- export declare class VolumeManager {
14
- private readonly _player;
15
- private readonly _volumeChangeDuration;
16
- private _volume;
17
- private _isLimiting;
18
- private _limitLevel;
19
- private _limitLevelType;
20
- private _startTime;
21
- private _startVolume;
22
- private _running;
23
- constructor(player: IMediaPlayer);
24
- /**
25
- * The selected volume.
26
- *
27
- * @remarks
28
- * Expressed as a value between 0.0 and 1.0. The default value is 1.0.
29
- * Can be used for things like volume sliders.
30
- *
31
- * Does not return the current volume if limiting is enabled, but the desired volume.
32
- */
33
- get volume(): number;
34
- set volume(value: number);
35
- /**
36
- * Target level to lower volume to.
37
- *
38
- * @remarks
39
- * Expressed as a value between 0.0 and 1.0. The value is applied based upon the configured
40
- * `levelType`. The default value is 0.1.
41
- *
42
- * For a level type of `LevelType.fixed` the value is the exact level the volume will be
43
- * lowered to. The default value of 0.1 would cause the volume to be lowered to 0.1.
44
- *
45
- * For a level type of `LevelType.percentage` the value is the percentage by which the volume
46
- * level should be lowered to. The default value of 0.1 would cause the volume to be lowered
47
- * to 10% of its starting value.
48
- */
49
- get limitLevel(): number;
50
- set limitLevel(value: number);
51
- /**
52
- * The type of level represented by the `limitLevel` property.
53
- */
54
- get limitLevelType(): LimitLevelType;
55
- set limitLevelType(value: LimitLevelType);
56
- /**
57
- * Amount of time, in seconds, it should take to change the volume up or down to the desired level.
58
- *
59
- * @remarks
60
- * Default `volumeChangeDuration` is 0.5 seconds.
61
- */
62
- get volumeChangeDuration(): number;
63
- set volumeChangeDuration(value: number);
64
- /**
65
- * Whether or not volume limiting is currently enabled.
66
- */
67
- get isLimiting(): boolean;
68
- /**
69
- * Limits volume based on `limitLevel` and `limitLevelType` properties.
70
- * @see `limitLevel`
71
- * @see `limitLevelType`
72
- */
73
- startLimiting(): void;
74
- /**
75
- * Disables volume limit.
76
- */
77
- stopLimiting(): void;
78
- private startAdjusting;
79
- private scheduleAnimationFrame;
80
- private computeInterpolatedVolume;
81
- private computeTargetVolume;
82
- private millisSinceVolumeChangeStart;
83
- }
84
- //# sourceMappingURL=VolumeManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VolumeManager.d.ts","sourceRoot":"","sources":["../src/VolumeManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,oBAAY,cAAc;IAAG,KAAK,IAAA;IAAE,UAAU,IAAA;CAAE;AAEhD;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAyB;IAG/D,OAAO,CAAC,OAAO,CAAO;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAEb,MAAM,EAAE,YAAY;IAKhC;;;;;;;;OAQG;IACH,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,MAAM,CAAC,KAAK,EAAE,MAAM,EAO9B;IAED;;;;;;;;;;;;;OAaG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED,IAAW,UAAU,CAAC,KAAK,EAAE,MAAM,EAMlC;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,cAAc,CAE1C;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,cAAc,EAE9C;IAED;;;;;OAKG;IACH,IAAW,oBAAoB,IAAI,MAAM,CAExC;IAED,IAAW,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAE5C;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED;;;;OAIG;IACI,aAAa,IAAI,IAAI;IAK5B;;OAEG;IACI,YAAY,IAAI,IAAI;IAK3B,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,4BAA4B;CAIvC"}
@@ -1,173 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the Microsoft Live Share SDK License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.VolumeManager = exports.LimitLevelType = void 0;
8
- const live_share_1 = require("@microsoft/live-share");
9
- var LimitLevelType;
10
- (function (LimitLevelType) {
11
- LimitLevelType[LimitLevelType["fixed"] = 0] = "fixed";
12
- LimitLevelType[LimitLevelType["percentage"] = 1] = "percentage";
13
- })(LimitLevelType = exports.LimitLevelType || (exports.LimitLevelType = {}));
14
- /**
15
- * Smooth audio level changes when volume is modified, or if volume limiting has started/ended.
16
- */
17
- class VolumeManager {
18
- constructor(player) {
19
- this._volumeChangeDuration = new live_share_1.TimeInterval(500);
20
- // defaults to player volume
21
- this._volume = 0.0;
22
- this._isLimiting = false;
23
- this._limitLevel = 0.1;
24
- this._limitLevelType = LimitLevelType.fixed;
25
- this._startTime = 0;
26
- this._startVolume = 0;
27
- this._running = false;
28
- this._player = player;
29
- this._volume = this._player.volume;
30
- }
31
- /**
32
- * The selected volume.
33
- *
34
- * @remarks
35
- * Expressed as a value between 0.0 and 1.0. The default value is 1.0.
36
- * Can be used for things like volume sliders.
37
- *
38
- * Does not return the current volume if limiting is enabled, but the desired volume.
39
- */
40
- get volume() {
41
- return this._volume;
42
- }
43
- set volume(value) {
44
- if (value < 0 || value > 1.0) {
45
- throw new Error(`VolumeManager: cannot set volume to ${value}. Level must be between 0.0 and 1.0.`);
46
- }
47
- this._volume = value;
48
- this.startAdjusting();
49
- }
50
- /**
51
- * Target level to lower volume to.
52
- *
53
- * @remarks
54
- * Expressed as a value between 0.0 and 1.0. The value is applied based upon the configured
55
- * `levelType`. The default value is 0.1.
56
- *
57
- * For a level type of `LevelType.fixed` the value is the exact level the volume will be
58
- * lowered to. The default value of 0.1 would cause the volume to be lowered to 0.1.
59
- *
60
- * For a level type of `LevelType.percentage` the value is the percentage by which the volume
61
- * level should be lowered to. The default value of 0.1 would cause the volume to be lowered
62
- * to 10% of its starting value.
63
- */
64
- get limitLevel() {
65
- return this._limitLevel;
66
- }
67
- set limitLevel(value) {
68
- if (value < 0 || value > 1.0) {
69
- throw new Error(`VolumeManager: cannot set level to ${value}. Level must be between 0.0 and 1.0.`);
70
- }
71
- this._limitLevel = value;
72
- }
73
- /**
74
- * The type of level represented by the `limitLevel` property.
75
- */
76
- get limitLevelType() {
77
- return this._limitLevelType;
78
- }
79
- set limitLevelType(value) {
80
- this._limitLevelType = value;
81
- }
82
- /**
83
- * Amount of time, in seconds, it should take to change the volume up or down to the desired level.
84
- *
85
- * @remarks
86
- * Default `volumeChangeDuration` is 0.5 seconds.
87
- */
88
- get volumeChangeDuration() {
89
- return this._volumeChangeDuration.seconds;
90
- }
91
- set volumeChangeDuration(value) {
92
- this._volumeChangeDuration.seconds = Math.abs(value);
93
- }
94
- /**
95
- * Whether or not volume limiting is currently enabled.
96
- */
97
- get isLimiting() {
98
- return this._isLimiting;
99
- }
100
- /**
101
- * Limits volume based on `limitLevel` and `limitLevelType` properties.
102
- * @see `limitLevel`
103
- * @see `limitLevelType`
104
- */
105
- startLimiting() {
106
- this._isLimiting = true;
107
- this.startAdjusting();
108
- }
109
- /**
110
- * Disables volume limit.
111
- */
112
- stopLimiting() {
113
- this._isLimiting = false;
114
- this.startAdjusting();
115
- }
116
- startAdjusting() {
117
- const adjustVolume = () => {
118
- // Schedule next animation frame if volume change not finished
119
- if (this.millisSinceVolumeChangeStart() <= this._volumeChangeDuration.milliseconds) {
120
- this._player.volume = this.computeInterpolatedVolume();
121
- this.scheduleAnimationFrame(adjustVolume);
122
- }
123
- else {
124
- this._player.volume = this.computeTargetVolume();
125
- this._running = false;
126
- }
127
- };
128
- this._startTime = new Date().getTime();
129
- this._startVolume = this._player.volume;
130
- if (!this._running) {
131
- this._running = true;
132
- this.scheduleAnimationFrame(adjustVolume);
133
- }
134
- }
135
- scheduleAnimationFrame(callback) {
136
- if (typeof requestAnimationFrame == "function") {
137
- requestAnimationFrame(callback);
138
- }
139
- else {
140
- setTimeout(callback, 20);
141
- }
142
- }
143
- computeInterpolatedVolume() {
144
- const volumeChangeMillis = this._volumeChangeDuration.milliseconds;
145
- const volumeDifference = this.computeTargetVolume() - this._startVolume;
146
- const adjustmentFromStart = volumeDifference / volumeChangeMillis * this.millisSinceVolumeChangeStart();
147
- return this._startVolume + adjustmentFromStart;
148
- }
149
- computeTargetVolume() {
150
- if (this._limitLevelType == LimitLevelType.percentage) {
151
- if (this._isLimiting) {
152
- return this._volume * this._limitLevel;
153
- }
154
- else {
155
- return this._volume;
156
- }
157
- }
158
- else {
159
- if (this._isLimiting && this._volume > this._limitLevel) {
160
- return this._limitLevel;
161
- }
162
- else {
163
- return this._volume;
164
- }
165
- }
166
- }
167
- millisSinceVolumeChangeStart() {
168
- const now = new Date().getTime();
169
- return now - this._startTime;
170
- }
171
- }
172
- exports.VolumeManager = VolumeManager;
173
- //# sourceMappingURL=VolumeManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VolumeManager.js","sourceRoot":"","sources":["../src/VolumeManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,sDAAqD;AAGrD,IAAY,cAAoC;AAAhD,WAAY,cAAc;IAAG,qDAAK,CAAA;IAAE,+DAAU,CAAA;AAAC,CAAC,EAApC,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAAsB;AAEhD;;GAEG;AACH,MAAa,aAAa;IAatB,YAAY,MAAoB;QAXf,0BAAqB,GAAG,IAAI,yBAAY,CAAC,GAAG,CAAC,CAAC;QAE/D,4BAA4B;QACpB,YAAO,GAAG,GAAG,CAAC;QACd,gBAAW,GAAG,KAAK,CAAC;QACpB,gBAAW,GAAG,GAAG,CAAA;QACjB,oBAAe,GAAmB,cAAc,CAAC,KAAK,CAAC;QACvD,eAAU,GAAG,CAAC,CAAC;QACf,iBAAY,GAAG,CAAC,CAAC;QACjB,aAAQ,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAa;QAC3B,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,uCAAuC,KAAK,sCAAsC,CAAC,CAAC;SACvG;QAED,IAAI,CAAC,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CAAC,WAAW,CAAC;aAC1C;iBAAM;gBACH,OAAO,IAAI,CAAC,OAAO,CAAC;aACvB;SACJ;aAAM;YACH,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE;gBACrD,OAAO,IAAI,CAAC,WAAW,CAAC;aAC3B;iBAAM;gBACH,OAAO,IAAI,CAAC,OAAO,CAAC;aACvB;SACJ;IACL,CAAC;IAEO,4BAA4B;QAChC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;IACjC,CAAC;CACJ;AA3KD,sCA2KC"}
package/bin/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- export * from './LiveMediaSession';
6
- export * from './LiveMediaSessionCoordinator';
7
- export * from './LiveMediaSessionCoordinatorSuspension';
8
- export * from './IMediaPlayer';
9
- export * from './MediaPlayerSynchronizer';
10
- export * from './MediaSessionActionThrottler';
11
- export * from './MediaSessionExtensions';
12
- export * from './RepeatedActionThrottler';
13
- export * from './VolumeManager';
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC"}
package/bin/index.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the Microsoft Live Share SDK License.
5
- */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- __exportStar(require("./LiveMediaSession"), exports);
22
- __exportStar(require("./LiveMediaSessionCoordinator"), exports);
23
- __exportStar(require("./LiveMediaSessionCoordinatorSuspension"), exports);
24
- __exportStar(require("./IMediaPlayer"), exports);
25
- __exportStar(require("./MediaPlayerSynchronizer"), exports);
26
- __exportStar(require("./MediaSessionActionThrottler"), exports);
27
- __exportStar(require("./MediaSessionExtensions"), exports);
28
- __exportStar(require("./RepeatedActionThrottler"), exports);
29
- __exportStar(require("./VolumeManager"), exports);
30
- //# sourceMappingURL=index.js.map
package/bin/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAGH,qDAAmC;AACnC,gEAA8C;AAC9C,0EAAwD;AACxD,iDAA+B;AAC/B,4DAA0C;AAC1C,gEAA8C;AAC9C,2DAAyC;AACzC,4DAA0C;AAC1C,kDAAgC"}
@@ -1,93 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- /// <reference types="node" />
6
- import { IEvent, ILiveEvent, TimeInterval, IRuntimeSignaler } from '@microsoft/live-share';
7
- import EventEmitter from 'events';
8
- import { ExtendedMediaMetadata, CoordinationWaitPoint, ExtendedMediaSessionPlaybackState, ExtendedMediaSessionActionDetails } from '../MediaSessionExtensions';
9
- import { GroupPlaybackTrack, IPlaybackTrack } from './GroupPlaybackTrack';
10
- import { GroupTransportState, ITransportState } from './GroupTransportState';
11
- import { GroupPlaybackPosition } from './GroupPlaybackPosition';
12
- import { IMediaPlayerState } from '../LiveMediaSessionCoordinator';
13
- import { GroupPlaybackTrackData, IPlaybackTrackData } from './GroupPlaybackTrackData';
14
- /**
15
- * @hidden
16
- */
17
- export interface IPositionUpdateEvent extends ILiveEvent {
18
- track: IPlaybackTrack;
19
- trackData: IPlaybackTrackData;
20
- transport: ITransportState;
21
- playbackState: ExtendedMediaSessionPlaybackState;
22
- position: number;
23
- waitPoint?: CoordinationWaitPoint;
24
- }
25
- /**
26
- * @hidden
27
- */
28
- export interface ITransportCommandEvent extends ILiveEvent {
29
- track: IPlaybackTrack;
30
- position: number;
31
- }
32
- /**
33
- * @hidden
34
- */
35
- export interface ISetTrackEvent extends ILiveEvent {
36
- metadata: ExtendedMediaMetadata | null;
37
- waitPoints: CoordinationWaitPoint[];
38
- }
39
- /**
40
- * @hidden
41
- */
42
- export interface ISetTrackDataEvent extends ILiveEvent {
43
- data: object | null;
44
- }
45
- /**
46
- * @hidden
47
- */
48
- export interface ITriggerActionEvent extends IEvent {
49
- details: ExtendedMediaSessionActionDetails;
50
- }
51
- /**
52
- * @hidden
53
- */
54
- export declare enum GroupCoordinatorStateEvents {
55
- newwaitpoint = "newwaitpoint",
56
- triggeraction = "triggeraction"
57
- }
58
- /**
59
- * @hidden
60
- */
61
- export declare class GroupCoordinatorState extends EventEmitter {
62
- private readonly _runtime;
63
- private readonly _logger;
64
- private readonly _maxPlaybackDrift;
65
- private _getMediaPlayerState;
66
- private _playbackTrack;
67
- private _playbackTrackData;
68
- private _transportState;
69
- private _playbackPosition;
70
- private _suspensionCnt;
71
- private _waitPoint?;
72
- private _lastStateChange;
73
- private _lastStateChangeTime;
74
- constructor(runtime: IRuntimeSignaler, maxPlaybackDrift: TimeInterval, positionUpdateInterval: TimeInterval, getMediaPlayerState: () => IMediaPlayerState);
75
- get playbackTrack(): GroupPlaybackTrack;
76
- get playbackTrackData(): GroupPlaybackTrackData;
77
- get transportState(): GroupTransportState;
78
- get playbackPosition(): GroupPlaybackPosition;
79
- get waitingAt(): CoordinationWaitPoint | undefined;
80
- get isSuspended(): boolean;
81
- get isWaiting(): boolean;
82
- beginSuspension(waitPoint?: CoordinationWaitPoint): void;
83
- endSuspension(syncState: boolean): void;
84
- createPositionUpdateEvent(state: IMediaPlayerState): Partial<IPositionUpdateEvent>;
85
- handleSetTrack(event: ISetTrackEvent, local: boolean): void;
86
- handleSetTrackData(event: ISetTrackDataEvent, local: boolean): void;
87
- handleTransportCommand(event: ITransportCommandEvent, local: boolean): void;
88
- handlePositionUpdate(event: IPositionUpdateEvent, local: boolean): void;
89
- syncLocalMediaSession(): Promise<void>;
90
- private emitSetTrack;
91
- private emitTriggerAction;
92
- }
93
- //# sourceMappingURL=GroupCoordinatorState.d.ts.map