@ldelia/react-media 0.8.2 → 0.8.3
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/dist/components/reproduction-widget/models/Player/PlayAlongPlayer.d.ts +0 -2
- package/dist/components/reproduction-widget/models/Player/PlayAlongPlayer.js +0 -2
- package/dist/components/reproduction-widget/models/Player/YouTubePlayer.d.ts +0 -2
- package/dist/components/reproduction-widget/models/Player/YouTubePlayer.js +0 -25
- package/dist/components/reproduction-widget/models/Reproduction.js +0 -2
- package/package.json +1 -1
|
@@ -26,8 +26,6 @@ export declare class PlayAlongPlayer {
|
|
|
26
26
|
setPlaybackRate(playbackRate: number): void;
|
|
27
27
|
on(eventName: keyof typeof PlayAlongPlayer.EVENTS, handler: () => void): number | undefined;
|
|
28
28
|
dispatch(eventName: keyof typeof PlayAlongPlayer.EVENTS): void;
|
|
29
|
-
countingStarted(): void;
|
|
30
|
-
countingFinished(): void;
|
|
31
29
|
setVolume(volume: number): void;
|
|
32
30
|
getVolume(): number;
|
|
33
31
|
private setInnerPlayer;
|
|
@@ -32,8 +32,6 @@ export declare class YouTubePlayer {
|
|
|
32
32
|
isAvailable(): boolean;
|
|
33
33
|
on(eventName: keyof typeof PlayAlongPlayer.EVENTS, handler: (error?: any) => void): number | undefined;
|
|
34
34
|
dispatch(eventName: keyof typeof PlayAlongPlayer.EVENTS, error?: any): void;
|
|
35
|
-
countingStarted(): void;
|
|
36
|
-
countingFinished(): void;
|
|
37
35
|
private getErrorMessage;
|
|
38
36
|
}
|
|
39
37
|
export {};
|
|
@@ -128,31 +128,6 @@ export class YouTubePlayer {
|
|
|
128
128
|
setTimeout(() => handler(error), 0);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
countingStarted() {
|
|
132
|
-
/**
|
|
133
|
-
* iOS browsers enforce strict autoplay policies that require video playback
|
|
134
|
-
* to begin synchronously within a user interaction event (e.g., a tap or click).
|
|
135
|
-
* When we implemented the counting-in feature (1, 2, 1, 2, 3, go...),
|
|
136
|
-
* the asynchronous delays between counts caused iOS to lose the user interaction context,
|
|
137
|
-
* blocking video playback after the countdown completed.
|
|
138
|
-
* The video would work fine on web and Android, but fail to start on iOS Safari.
|
|
139
|
-
* To resolve this, we adopted a muted-first approach:
|
|
140
|
-
* the video begins playing immediately when the user initiates playback,
|
|
141
|
-
* but remains muted during the countdown sequence.
|
|
142
|
-
* Once the countdown completes, we unmute the video and restore the desired volume.
|
|
143
|
-
* This strategy satisfies iOS's autoplay requirements (muted videos can autoplay)
|
|
144
|
-
* while preserving the musical countdown experience.
|
|
145
|
-
* The user never notices the video is playing during the countdown
|
|
146
|
-
* since it's both muted and visually obscured by the countdown overlay.
|
|
147
|
-
* */
|
|
148
|
-
this.getInnerPlayer().setVolume(0);
|
|
149
|
-
this.getInnerPlayer().playVideo();
|
|
150
|
-
}
|
|
151
|
-
countingFinished() {
|
|
152
|
-
this.getInnerPlayer().pauseVideo();
|
|
153
|
-
this.getInnerPlayer().seekTo(0, true);
|
|
154
|
-
this.setVolume(this.volume);
|
|
155
|
-
}
|
|
156
131
|
getErrorMessage(errorCode) {
|
|
157
132
|
switch (errorCode) {
|
|
158
133
|
case YT.PlayerError.InvalidParam:
|
|
@@ -200,7 +200,6 @@ export class Reproduction {
|
|
|
200
200
|
}
|
|
201
201
|
countInAndPlay(timeout, limit) {
|
|
202
202
|
// the initial count starts instantly, no need to wait
|
|
203
|
-
this.player.countingStarted();
|
|
204
203
|
this.countingInCounter++;
|
|
205
204
|
this.dispatch(Reproduction.EVENTS.COUNTING_IN, { countingInCounter: this.countingInCounter });
|
|
206
205
|
const interval = setInterval(() => {
|
|
@@ -212,7 +211,6 @@ export class Reproduction {
|
|
|
212
211
|
this.countInAndPlay(this.getBPMInterval(), 5);
|
|
213
212
|
}
|
|
214
213
|
else {
|
|
215
|
-
this.player.countingFinished();
|
|
216
214
|
this.play();
|
|
217
215
|
}
|
|
218
216
|
}
|