multi_embed_player 3.0.1 → 3.1.1

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.
@@ -1,80 +1,152 @@
1
- import { SoundCloudContent, IPlayer, PlayerState, EventHandler } from '../types';
2
- interface SoundCloudWidget {
3
- bind(event: string, callback: () => void): void;
4
- play(): void;
5
- pause(): void;
6
- toggle(): void;
7
- seekTo(milliseconds: number): void;
8
- setVolume(volume: number): void;
9
- next(): void;
10
- prev(): void;
11
- skip(soundIndex: number): void;
12
- load(url: string, options?: any): void;
13
- reload(): void;
14
- getVolume(callback: (volume: number) => void): void;
15
- getDuration(callback: (duration: number) => void): void;
16
- getPosition(callback: (position: number) => void): void;
17
- getSounds(callback: (sounds: any[]) => void): void;
18
- getCurrentSound(callback: (sound: any) => void): void;
19
- getCurrentSoundIndex(callback: (index: number) => void): void;
20
- isPaused(callback: (paused: boolean) => void): void;
1
+ declare var SC: any;
2
+ /**
3
+ * @typedef {Object} mep_soundcloud_load_object
4
+ * @property {string} videoId - The ID of the video.
5
+ * @property {number} [startSeconds] - The start time of the video.
6
+ * @property {number} [endSeconds] - The end time of the video.
7
+ */
8
+ /**
9
+ * @typedef {Object} mep_soundcloud_playerVars
10
+ * @property {number} [autoplay] - Whether to autoplay the initial video.
11
+ * @property {number} [hide_related] - Hide related videos after the video ends.
12
+ * @property {number} [show_comments] - Show comments.
13
+ * @property {number} [show_user] - Show the user's name and profile picture.
14
+ * @property {number} [show_reposts] - Show reposts.
15
+ * @property {number} [visual] - Show the video title and other visual metadata.
16
+ * @property {number} [startSeconds] - The start time of the video.
17
+ * @property {number} [endSeconds] - The end time of the video.
18
+ */
19
+ /**
20
+ * @typedef {Object} mep_soundcloud_content
21
+ * @property {string} videoId - The ID of the video.
22
+ * @property {mep_soundcloud_playerVars} [playerVars] - Player parameters.
23
+ * @property {number} width - The width of the video player.
24
+ * @property {number} height - The height of the video player.
25
+ */
26
+ interface mep_soundcloud_load_object {
27
+ videoId: string;
28
+ startSeconds?: number;
29
+ endSeconds?: number;
30
+ }
31
+ interface mep_soundcloud_playerVars {
32
+ autoplay?: number | string;
33
+ hide_related?: number | string;
34
+ show_comments?: number | string;
35
+ show_user?: number | string;
36
+ show_reposts?: number | string;
37
+ visual?: number | string;
38
+ startSeconds?: number;
39
+ endSeconds?: number;
40
+ [key: string]: number | string | undefined;
21
41
  }
22
- declare global {
23
- interface Window {
24
- SC: {
25
- Widget: {
26
- (iframe: HTMLIFrameElement): SoundCloudWidget;
27
- };
28
- };
29
- }
42
+ interface mep_soundcloud_content {
43
+ videoId: string;
44
+ playerVars?: mep_soundcloud_playerVars;
45
+ width: number;
46
+ height: number;
47
+ }
48
+ interface TrackData {
49
+ currentPosition: number;
50
+ }
51
+ interface SoundMetadata {
52
+ title: string;
53
+ duration: number;
30
54
  }
31
55
  /**
32
56
  * Class representing a SoundCloud player.
33
57
  */
34
- export declare class mep_soundcloud implements IPlayer {
35
- private static soundcloud_api_loaded;
36
- private static soundcloud_api_promise;
37
- private player;
38
- private iframe;
39
- private widget;
40
- private autoplay;
41
- private startSeconds;
42
- private endSeconds;
43
- private playerState;
44
- private currentTime;
45
- private duration;
46
- private volume;
47
- private muted;
58
+ declare class mep_soundcloud {
59
+ #private;
60
+ player: HTMLIFrameElement;
61
+ playerVars: mep_soundcloud_playerVars | undefined;
62
+ player_statusdata: any;
63
+ autoplay: boolean;
64
+ player_widget: any;
65
+ player_metadata: any;
66
+ before_mute_volume: number;
67
+ forse_pause: boolean;
68
+ first_seek_time: number;
69
+ endSeconds: number;
70
+ pause_sended: boolean;
71
+ interval: number;
72
+ previous_player_status: number;
73
+ retry_count: number;
74
+ static soundcloud_api_loaded: boolean | null;
75
+ static soundcloud_api_promise: (() => void)[];
76
+ static numericRegex: RegExp;
77
+ constructor(replacing_element: string | HTMLElement, content: mep_soundcloud_content, player_set_event_function?: (player: HTMLIFrameElement) => void);
48
78
  /**
49
- * Load SoundCloud Widget API asynchronously.
79
+ * This function plays the video.
50
80
  */
51
- private load_soundcloud_api;
52
- constructor(replacing_element: string | HTMLElement, content: SoundCloudContent, player_set_event_function?: EventHandler);
53
- private load;
54
- private setup_event_listeners;
55
81
  playVideo(): void;
82
+ /**
83
+ * This function pauses the video.
84
+ */
56
85
  pauseVideo(): void;
57
- getCurrentTime(): Promise<number>;
58
- getDuration(): Promise<number>;
59
- seekTo(time: number): Promise<void>;
86
+ /**
87
+ * This function return the current time of the video.
88
+ * @returns {number} current time of the video
89
+ */
90
+ getCurrentTime(): number;
91
+ /**
92
+ * This function return the duration of the video.
93
+ * @returns {number} duration of the video
94
+ */
95
+ getDuration(): number;
96
+ /**
97
+ * This function seeks to a specified time in the video.
98
+ * @param {number} skipSecounds - The time to which the player should advance.
99
+ */
100
+ seekTo(skipSecounds: number): void;
101
+ /**
102
+ * This function sets the volume of the video player.
103
+ * @param {number} volume
104
+ */
60
105
  setVolume(volume: number): void;
61
- getVolume(): Promise<number>;
106
+ /**
107
+ * This function mutes the video player.
108
+ */
62
109
  mute(): void;
110
+ /**
111
+ * This function unmutes the video player.
112
+ */
63
113
  unMute(): void;
64
- isMuted(): Promise<boolean>;
65
- getPlayerState(): Promise<PlayerState>;
66
114
  /**
67
- * Get real duration between start and end times.
115
+ * This function checks whether the video player is muted.
116
+ * @returns {boolean} true if the video player is muted, and false if not.
117
+ */
118
+ isMuted(): boolean;
119
+ /**
120
+ * This function returns the volume of the video player.
121
+ * @returns {number} volume of the video player
122
+ */
123
+ getVolume(): any;
124
+ /**
125
+ * This function returns the status of the video player.
126
+ * @returns {number} status code
127
+ */
128
+ getPlayerState(): any;
129
+ /**
130
+ * This function returns the title of the video.
131
+ * @returns {string} title of the video
132
+ */
133
+ getTitle(): any;
134
+ /**
135
+ * return duration between start and end seconds
136
+ * @returns {number} dulation of between start and end
68
137
  */
69
- getRealDulation(): Promise<number>;
138
+ getRealDulation(): number;
70
139
  /**
71
- * Load track by ID.
140
+ * Load a new video into the player.With autoplay
141
+ * @param {mep_soundcloud_load_object} content
142
+ * @param {number} startSeconds
72
143
  */
73
- loadVideoById(content: SoundCloudContent): void;
144
+ loadVideoById(content: mep_soundcloud_load_object | string, startSeconds: number): void;
74
145
  /**
75
- * Cue track by ID.
146
+ * Load a new video into the player.Without autoplay
147
+ * @param {mep_soundcloud_load_object} content
148
+ * @param {number} startSeconds
76
149
  */
77
- cueVideoById(content: SoundCloudContent): void;
150
+ cueVideoById(content: mep_soundcloud_load_object | string, startSeconds: number): void;
78
151
  }
79
- export {};
80
152
  //# sourceMappingURL=soundcloud.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"soundcloud.d.ts","sourceRoot":"","sources":["../../iframe_api/soundcloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEvG,UAAU,gBAAgB;IACxB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAChD,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACvC,MAAM,IAAI,IAAI,CAAC;IACf,SAAS,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACpD,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,C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