multi_embed_player 3.1.0 → 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.
Files changed (117) hide show
  1. package/dist/iframe_api/bilibili.d.ts +210 -0
  2. package/dist/iframe_api/bilibili.d.ts.map +1 -0
  3. package/dist/iframe_api/bilibili.js +1035 -0
  4. package/dist/iframe_api/bilibili.js.map +1 -0
  5. package/dist/iframe_api/niconico.d.ts +191 -0
  6. package/dist/iframe_api/niconico.d.ts.map +1 -0
  7. package/dist/iframe_api/niconico.js +325 -0
  8. package/dist/iframe_api/niconico.js.map +1 -0
  9. package/dist/iframe_api/soundcloud.d.ts +152 -0
  10. package/dist/iframe_api/soundcloud.d.ts.map +1 -0
  11. package/dist/iframe_api/soundcloud.js +360 -0
  12. package/dist/iframe_api/soundcloud.js.map +1 -0
  13. package/dist/iframe_api/youtube.d.ts +96 -0
  14. package/dist/iframe_api/youtube.d.ts.map +1 -0
  15. package/dist/iframe_api/youtube.js +269 -0
  16. package/dist/iframe_api/youtube.js.map +1 -0
  17. package/dist/multi_embed_player.d.ts +215 -0
  18. package/dist/multi_embed_player.d.ts.map +1 -0
  19. package/dist/multi_embed_player.js +921 -0
  20. package/dist/multi_embed_player.js.map +1 -0
  21. package/package.json +1 -1
  22. package/.github/workflows/build-and-deploy.yml +0 -44
  23. package/.gitmodules +0 -3
  24. package/browserExtention/chrome/background.js +0 -55
  25. package/browserExtention/chrome/extention.json +0 -1
  26. package/browserExtention/chrome/liteplayer.js +0 -26439
  27. package/browserExtention/chrome/manifest.json +0 -31
  28. package/browserExtention/chrome/player-selector.js +0 -1854
  29. package/browserExtention/firefox/background.js +0 -27
  30. package/browserExtention/firefox/extention.json +0 -1
  31. package/browserExtention/firefox/liteplayer.js +0 -26439
  32. package/browserExtention/firefox/manifest.json +0 -19
  33. package/browserExtention/firefox/player-selector.js +0 -1854
  34. package/documents/.hugo_build.lock +0 -0
  35. package/documents/archetypes/default.md +0 -5
  36. package/documents/assets/jsconfig.json +0 -11
  37. package/documents/content/docs/install.md +0 -103
  38. package/documents/content/docs/quickstart.md +0 -51
  39. package/documents/content/docs/reference/HTML.md +0 -31
  40. package/documents/content/docs/reference/_index.md +0 -10
  41. package/documents/content/docs/reference/error_code.md +0 -23
  42. package/documents/content/docs/reference/iframe_api.md +0 -737
  43. package/documents/content/docs/reference/iframe_class.md +0 -230
  44. package/documents/content/docs/reference/multi_embed_player_class.md +0 -113
  45. package/documents/content/docs/reference/reserved_words.md +0 -71
  46. package/documents/content/docs/usage/GDPR_mode.md +0 -77
  47. package/documents/content/docs/usage/_index.md +0 -10
  48. package/documents/content/docs/usage/custom_playlist.md +0 -239
  49. package/documents/content/docs/usage/embed_api.md +0 -163
  50. package/documents/content/docs/usage/embed_various_service.md +0 -81
  51. package/documents/content/docs/usage/thumbnail_click.md +0 -57
  52. package/documents/go.mod +0 -8
  53. package/documents/go.sum +0 -14
  54. package/documents/hugo.toml +0 -18
  55. package/documents/layouts/partials/docs/sidebar.html +0 -117
  56. package/documents/layouts/partials/landing/features.html +0 -47
  57. package/documents/layouts/robots.txt +0 -4
  58. package/documents/static/_headers +0 -7
  59. package/documents/static/localStorageCheck.html +0 -27
  60. package/documents/static/no_extention.json +0 -1
  61. package/example.html +0 -27
  62. package/extention.json +0 -1
  63. package/icon/video_not_found.odg +0 -0
  64. package/icon/video_not_found.svgz +0 -0
  65. package/iframe_api/bilibili.ts +0 -1095
  66. package/iframe_api/niconico.ts +0 -429
  67. package/iframe_api/soundcloud.ts +0 -450
  68. package/iframe_api/youtube.ts +0 -311
  69. package/multi_embed_player.ts +0 -989
  70. package/player_api_gate/bilibili-api-gate/cgi/cpp/bilibili-api-gate-cgi.cpp +0 -281
  71. package/player_api_gate/bilibili-api-gate/cgi/go/src.go +0 -46
  72. package/player_api_gate/bilibili-api-gate/cloudflare_workers/package-lock.json +0 -1356
  73. package/player_api_gate/bilibili-api-gate/cloudflare_workers/package.json +0 -12
  74. package/player_api_gate/bilibili-api-gate/cloudflare_workers/src/index.js +0 -50
  75. package/player_api_gate/bilibili-api-gate/cloudflare_workers/wrangler.toml +0 -3
  76. package/player_api_gate/iframe-api-ts/.editorconfig +0 -12
  77. package/player_api_gate/iframe-api-ts/.prettierrc +0 -6
  78. package/player_api_gate/iframe-api-ts/package-lock.json +0 -3054
  79. package/player_api_gate/iframe-api-ts/package.json +0 -18
  80. package/player_api_gate/iframe-api-ts/src/bilibili.ts +0 -49
  81. package/player_api_gate/iframe-api-ts/src/index.ts +0 -35
  82. package/player_api_gate/iframe-api-ts/src/niconico.ts +0 -95
  83. package/player_api_gate/iframe-api-ts/src/soundcloud.ts +0 -38
  84. package/player_api_gate/iframe-api-ts/src/types.ts +0 -115
  85. package/player_api_gate/iframe-api-ts/src/url-proxy.ts +0 -29
  86. package/player_api_gate/iframe-api-ts/src/utils.ts +0 -82
  87. package/player_api_gate/iframe-api-ts/src/youtube.ts +0 -41
  88. package/player_api_gate/iframe-api-ts/test/bilibili.spec.ts +0 -47
  89. package/player_api_gate/iframe-api-ts/test/env.d.ts +0 -3
  90. package/player_api_gate/iframe-api-ts/test/index.spec.ts +0 -59
  91. package/player_api_gate/iframe-api-ts/test/niconico.spec.ts +0 -55
  92. package/player_api_gate/iframe-api-ts/test/soundcloud.spec.ts +0 -55
  93. package/player_api_gate/iframe-api-ts/test/tsconfig.json +0 -8
  94. package/player_api_gate/iframe-api-ts/test/url-proxy.spec.ts +0 -46
  95. package/player_api_gate/iframe-api-ts/test/youtube.spec.ts +0 -45
  96. package/player_api_gate/iframe-api-ts/tsconfig.json +0 -45
  97. package/player_api_gate/iframe-api-ts/vitest.config.mts +0 -11
  98. package/player_api_gate/iframe-api-ts/worker-configuration.d.ts +0 -5768
  99. package/player_api_gate/iframe-api-ts/wrangler.jsonc +0 -47
  100. package/player_api_gate/iframe_api/.editorconfig +0 -13
  101. package/player_api_gate/iframe_api/.prettierrc +0 -6
  102. package/player_api_gate/iframe_api/package-lock.json +0 -1307
  103. package/player_api_gate/iframe_api/package.json +0 -12
  104. package/player_api_gate/iframe_api/src/bilibili_api.js +0 -60
  105. package/player_api_gate/iframe_api/src/index.js +0 -47
  106. package/player_api_gate/iframe_api/src/niconico_api.js +0 -112
  107. package/player_api_gate/iframe_api/src/soundcloud_api.js +0 -57
  108. package/player_api_gate/iframe_api/src/url_proxy.js +0 -28
  109. package/player_api_gate/iframe_api/src/youtube_api.js +0 -44
  110. package/player_api_gate/iframe_api/wrangler.toml +0 -51
  111. package/player_api_gate/niconico-imager/cgi/go/src.go +0 -74
  112. package/player_api_gate/niconico-imager/cloudflare_workers/package-lock.json +0 -2175
  113. package/player_api_gate/niconico-imager/cloudflare_workers/package.json +0 -12
  114. package/player_api_gate/niconico-imager/cloudflare_workers/src/index.js +0 -78
  115. package/player_api_gate/niconico-imager/cloudflare_workers/wrangler.toml +0 -3
  116. package/test_script.html +0 -172
  117. package/tsconfig.json +0 -36
@@ -1,450 +0,0 @@
1
- declare var SC: any;
2
-
3
- //Notice! This file JSDOC is generated by gitHub Copilot
4
- // So some of the comments may be wrong
5
- // Please refer to documents https://multi-embed-player.pages.dev/docs/reference/iframe_class/#mep_soundcloud
6
-
7
- /**
8
- * @typedef {Object} mep_soundcloud_load_object
9
- * @property {string} videoId - The ID of the video.
10
- * @property {number} [startSeconds] - The start time of the video.
11
- * @property {number} [endSeconds] - The end time of the video.
12
- */
13
-
14
- /**
15
- * @typedef {Object} mep_soundcloud_playerVars
16
- * @property {number} [autoplay] - Whether to autoplay the initial video.
17
- * @property {number} [hide_related] - Hide related videos after the video ends.
18
- * @property {number} [show_comments] - Show comments.
19
- * @property {number} [show_user] - Show the user's name and profile picture.
20
- * @property {number} [show_reposts] - Show reposts.
21
- * @property {number} [visual] - Show the video title and other visual metadata.
22
- * @property {number} [startSeconds] - The start time of the video.
23
- * @property {number} [endSeconds] - The end time of the video.
24
- */
25
-
26
- /**
27
- * @typedef {Object} mep_soundcloud_content
28
- * @property {string} videoId - The ID of the video.
29
- * @property {mep_soundcloud_playerVars} [playerVars] - Player parameters.
30
- * @property {number} width - The width of the video player.
31
- * @property {number} height - The height of the video player.
32
- */
33
-
34
- // TypeScript interfaces based on JSDoc
35
- interface mep_soundcloud_load_object {
36
- videoId: string;
37
- startSeconds?: number;
38
- endSeconds?: number;
39
- }
40
-
41
- interface mep_soundcloud_playerVars {
42
- autoplay?: number | string;
43
- hide_related?: number | string;
44
- show_comments?: number | string;
45
- show_user?: number | string;
46
- show_reposts?: number | string;
47
- visual?: number | string;
48
- startSeconds?: number;
49
- endSeconds?: number;
50
- [key: string]: number | string | undefined;
51
- }
52
-
53
- interface mep_soundcloud_content {
54
- videoId: string;
55
- playerVars?: mep_soundcloud_playerVars;
56
- width: number;
57
- height: number;
58
- }
59
-
60
- interface TrackData {
61
- currentPosition: number;
62
- }
63
-
64
- interface SoundMetadata {
65
- title: string;
66
- duration: number;
67
- }
68
-
69
- /**
70
- * Class representing a SoundCloud player.
71
- */
72
- class mep_soundcloud{
73
- player: HTMLIFrameElement = document.createElement("iframe");
74
- playerVars: mep_soundcloud_playerVars | undefined;
75
- player_statusdata: any;
76
- autoplay: boolean = false;
77
- player_widget: any;
78
- player_metadata: any;
79
- before_mute_volume: number = 100;
80
- forse_pause: boolean = false;
81
- first_seek_time: number = -1;
82
- endSeconds: number = -1;
83
- pause_sended: boolean = false;
84
- interval: number = 0;
85
- previous_player_status: number = -1;
86
- retry_count: number = 0;
87
-
88
- static soundcloud_api_loaded: boolean | null = null;
89
- static soundcloud_api_promise: (() => void)[] = [];
90
- static numericRegex = /^[0-9]+$/;
91
- async #load_soundcloud_api(){
92
- if((window as any).mep_soundcloud.soundcloud_api_loaded === null){
93
- if(typeof SC!=="object"){
94
- (window as any).mep_soundcloud.soundcloud_api_loaded = false;
95
- const script_document = document.createElement("script");
96
- script_document.src = "https://w.soundcloud.com/player/api.js";
97
- script_document.addEventListener("load",()=>{(window as any).mep_soundcloud.soundcloud_api_loaded = true;(window as any).mep_soundcloud.soundcloud_api_promise.forEach((func: () => void)=>func())});
98
- script_document.addEventListener("error",()=>{this.player.dispatchEvent(new CustomEvent("onError",{detail:{code:1001}}))});
99
- document.body.appendChild(script_document);
100
- await new Promise((resolve,reject)=>(window as any).mep_soundcloud.soundcloud_api_promise.push(resolve));
101
- }
102
- else{
103
- (window as any).mep_soundcloud.soundcloud_api_loaded = true;
104
- }
105
- }
106
- else if((window as any).mep_soundcloud.soundcloud_api_loaded === false){
107
- await new Promise((resolve,reject)=>(window as any).mep_soundcloud.soundcloud_api_promise.push(resolve));
108
- }
109
- }
110
- constructor(replacing_element: string | HTMLElement, content: mep_soundcloud_content, player_set_event_function?: (player: HTMLIFrameElement) => void){
111
- this.#load(replacing_element,content,player_set_event_function);
112
- }
113
- async #load(replacing_element: string | HTMLElement, content: mep_soundcloud_content, player_set_event_function?: (player: HTMLIFrameElement) => void){
114
- this.player.style.border = "none";
115
- this.player.allow = "autoplay";
116
- if(typeof player_set_event_function === "function"){
117
- player_set_event_function(this.player);
118
- }
119
- await this.#load_soundcloud_api();
120
- let iframe_replace_node: HTMLElement | null = null;
121
- if(typeof replacing_element==="string"){
122
- iframe_replace_node = document.getElementById(replacing_element);
123
- } else {
124
- iframe_replace_node = replacing_element;
125
- }
126
- let url_params = new URLSearchParams();
127
- let tflist = ["autoplay","hide_related","show_comments","show_user","show_user","show_reposts","visual"];
128
- this.playerVars = content.playerVars;
129
- this.player_statusdata = {playing_status:1,currentPosition:0,volume:100};
130
- if(typeof content.playerVars === "object" && content.playerVars !== null){
131
- tflist.forEach(option=>{
132
- if(content.playerVars && typeof content.playerVars[option]==="number"){
133
- content.playerVars[option] = content.playerVars[option].toString()
134
- }
135
- if(!content.playerVars || typeof content.playerVars[option] === "undefined"){
136
- url_params.set(option,"true");
137
- }
138
- else if(content.playerVars[option] === "1" || content.playerVars[option] === "true"){
139
- url_params.set(option,"true");
140
- }
141
- else if(content.playerVars[option] === "0" || content.playerVars[option] === "false"){
142
- url_params.set(option,"false");
143
- }
144
- else{
145
- url_params.set(option,content.playerVars[option] as string);
146
- }
147
- });
148
- if(content.playerVars && (content.playerVars.autoplay == "true" || content.playerVars.autoplay == 1)){
149
- this.autoplay = true;
150
- }
151
- }
152
- else{
153
- tflist.forEach(option=>{url_params.set(option,"false");});
154
- }
155
- if((window as any).mep_soundcloud.numericRegex.test(content.videoId)){
156
- this.player.src = `https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/${content.videoId}&${url_params.toString()}`;
157
- }
158
- else{
159
- this.player.src = `https://w.soundcloud.com/player/?url=https://soundcloud.com/${content.videoId}&${url_params.toString()}`;
160
- }
161
- if (iframe_replace_node) {
162
- iframe_replace_node.replaceWith(this.player);
163
- }
164
- this.player_widget = SC.Widget(this.player);
165
- this.player_metadata = {};//renew when load new ones
166
- this.forse_pause = !this.autoplay;
167
- this.player_widget.bind(SC.Widget.Events.READY,()=>{this.#ready_function()});
168
- this.player_widget.bind(SC.Widget.Events.PLAY_PROGRESS,(data: TrackData)=>{this.#tracker(data);this.#tracking_function()});
169
- this.player_widget.bind(SC.Widget.Events.PLAY,()=>{if(this.first_seek_time!==-1){this.seekTo(this.first_seek_time);this.first_seek_time=-1};this.player_statusdata.playing_status = 2});
170
- this.player_widget.bind(SC.Widget.Events.PAUSE,()=>{this.player_statusdata.playing_status = 3;this.pause_sended = false;this.forse_pause = true});
171
- //this.player_widget.bind(SC.Widget.Events.SEEK,()=>this.player_statusdata.playing_status = 3);
172
- this.player_widget.bind(SC.Widget.Events.FINISH,()=>{this.player.dispatchEvent(new Event("onEndVideo"));this.player_statusdata.playing_status = 4});
173
- this.player_widget.bind(SC.Widget.Events.ERROR,()=>this.player.dispatchEvent(new Event("onError")));
174
- if(this.autoplay){
175
- this.#startTracking();
176
- }
177
- this.first_seek_time = (content.playerVars && typeof content.playerVars.startSeconds === "number")?content.playerVars.startSeconds:-1;
178
- this.endSeconds = (content.playerVars && typeof content.playerVars.endSeconds === "number")?content.playerVars.endSeconds:-1;
179
- }
180
- /**
181
- * execute when player is ready
182
- * @param {boolean} retry
183
- */
184
- #ready_function(retry: boolean = false){
185
- this.player.dispatchEvent(new Event("onReady"));
186
- this.player_widget.getCurrentSound((data: SoundMetadata | null)=>{if(data===null){this.player.dispatchEvent(new Event("onError"))};this.player_metadata = data});
187
- if(this.autoplay&&!this.forse_pause){
188
- this.playVideo();
189
- if(retry&&this.retry_count<7){
190
- this.retry_count++;
191
- setTimeout(()=>{this.#ready_function(true)},1000);
192
- }
193
- }
194
- }
195
- /**
196
- * save current position
197
- * @param {Object} trackData
198
- */
199
- #tracker(trackData: TrackData){
200
- this.player_statusdata.currentPosition = trackData.currentPosition;
201
- }
202
- /**
203
- * This function tracks the player's state and fires events as needed.
204
- * Specifically, it fires events when the playback state changes or when a certain playback time is reached.
205
- */
206
- #tracking_function(){
207
- //this.player_widget.getVolume((volume)=>{this.player_statusdata.volume = volume});
208
- //this.player_widget.isPaused((pause_status)=>{pause_status?this.player_statusdata.playing_status = 3:this.player_statusdata.playing_status = 2});
209
- if(this.previous_player_status!==this.player_statusdata.playing_status){
210
- this.previous_player_status = this.player_statusdata.playing_status;
211
- this.player.dispatchEvent(new CustomEvent("onStateChange",{detail:this.getPlayerState()}));
212
- }
213
- if(this.endSeconds!=-1&&this.endSeconds<=this.getCurrentTime()){
214
- if(!this.pause_sended){
215
- this.pause_sended = true;
216
- this.pauseVideo();
217
- this.player.dispatchEvent(new Event("onEndVideo"));
218
- this.player_statusdata.playing_status = 4;
219
- }
220
- }
221
- }
222
- /**
223
- * This function sets an interval for state tracking. However, in the current code, it's commented out and does nothing.
224
- */
225
- #startTracking(){
226
- if(this.interval===0){
227
- //this.interval = setInterval(()=>{this.tracking_function()},1000);
228
- }
229
- }
230
- /**
231
- * This function clears the interval set for state tracking and calls the #tracking_function() method.
232
- */
233
- #stopTracking(){
234
- clearInterval(this.interval);
235
- this.interval = 0;
236
- this.#tracking_function();
237
- }
238
- /**
239
- * This function plays the video.
240
- */
241
- playVideo(){
242
- this.#startTracking();
243
- if(this.first_seek_time!==-1){
244
- this.seekTo(this.first_seek_time);
245
- this.first_seek_time = -1;
246
- }
247
- this.player_widget.play();
248
- }
249
- /**
250
- * This function pauses the video.
251
- */
252
- pauseVideo(){
253
- this.#stopTracking();
254
- this.player_widget.pause();
255
- this.forse_pause = true;
256
- }
257
- /**
258
- * This function return the current time of the video.
259
- * @returns {number} current time of the video
260
- */
261
- getCurrentTime(){
262
- return this.player_statusdata.currentPosition/1000;
263
- }
264
- /**
265
- * This function return the duration of the video.
266
- * @returns {number} duration of the video
267
- */
268
- getDuration(){
269
- return this.player_metadata.duration / 1000;
270
- }
271
- /**
272
- * This function seeks to a specified time in the video.
273
- * @param {number} skipSecounds - The time to which the player should advance.
274
- */
275
- seekTo(skipSecounds: number){
276
- if(typeof skipSecounds === "number"){
277
- this.player_widget.seekTo(skipSecounds*1000);
278
- }
279
- else{
280
- console.error("seekTo argument must be number");
281
- }
282
- }
283
- /**
284
- * This function sets the volume of the video player.
285
- * @param {number} volume
286
- */
287
- setVolume(volume: number){
288
- this.player_widget.setVolume(volume);
289
- this.player_statusdata.volume = volume;
290
- }
291
- /**
292
- * This function mutes the video player.
293
- */
294
- mute(){
295
- this.before_mute_volume = this.player_statusdata.volume;
296
- this.setVolume(0);
297
- }
298
- /**
299
- * This function unmutes the video player.
300
- */
301
- unMute(){
302
- this.setVolume(this.before_mute_volume);
303
- }
304
- /**
305
- * This function checks whether the video player is muted.
306
- * @returns {boolean} true if the video player is muted, and false if not.
307
- */
308
- isMuted(){
309
- return this.player_statusdata.volume===0;
310
- }
311
- /**
312
- * This function returns the volume of the video player.
313
- * @returns {number} volume of the video player
314
- */
315
- getVolume(){
316
- return this.player_statusdata.volume;
317
- }
318
- /**
319
- * This function returns the status of the video player.
320
- * @returns {number} status code
321
- */
322
- getPlayerState(){
323
- return this.player_statusdata.playing_status;
324
- }
325
- /**
326
- * This function returns the title of the video.
327
- * @returns {string} title of the video
328
- */
329
- getTitle(){
330
- return this.player_metadata.title;
331
- }
332
- /**
333
- * return duration between start and end seconds
334
- * @returns {number} dulation of between start and end
335
- */
336
- getRealDulation(){//original function
337
- if(this.endSeconds==-1){
338
- return this.getDuration() - this.first_seek_time;
339
- }
340
- else{
341
- return this.endSeconds - this.first_seek_time;
342
- }
343
- }
344
- /**
345
- * Load a new video into the player.
346
- * @param {mep_soundcloud_load_object} content
347
- * @param {number} startSeconds
348
- * @param {boolean} autoplay
349
- */
350
- #musicLoader(content: mep_soundcloud_load_object | string, startSeconds: number, autoplay: boolean){
351
- /*
352
- let options = {playerVars:this.playerVars};
353
- if(options.playerVars === undefined){
354
- options.playerVars = {};
355
- }
356
- options.playerVars["autoplay"] = autoplay;
357
- if(typeof content === "string"){
358
- options["videoId"] = content;
359
- }
360
- else if (typeof content === "object"){
361
- options["videoId"] = content["videoId"];
362
- if(typeof startSeconds === "number"){
363
- options["start"] = startSeconds;
364
- }
365
- else if(typeof content["startSeconds"] === "number"){
366
- options["start"] = content["startSeconds"];
367
- }
368
- if(typeof content["endSeconds"] === "number"){
369
- options["end"] = content["endSeconds"];
370
- }
371
- }
372
- const tmp_replace_element = document.createElement("div");
373
- tmp_replace_element.replaceWith(this.player);
374
- this.load(tmp_replace_element,options);
375
- */
376
-
377
- let url_params: any = {set(op: string, val: string){this[op]=val}}
378
- let tflist = ["hide_related","show_comments","show_user","show_user","show_reposts","visual"];
379
- if(this.playerVars && typeof this.playerVars==="object"){
380
- tflist.forEach(option=>{
381
- if(this.playerVars && typeof this.playerVars[option] === "string"&&this.playerVars[option] === "true"){
382
- url_params.set(option,"true");
383
- }
384
- else{
385
- url_params.set(option,"false");
386
- }
387
- });
388
- }
389
- else{
390
- tflist.forEach(option=>{url_params.set(option,"false");});
391
- }
392
- url_params.set("autoplay",autoplay?"true":"false");
393
- this.autoplay = autoplay;
394
- let musicId = "";
395
- if(typeof content === "object"){
396
- musicId = content.videoId;
397
- if(typeof content.startSeconds=="number"&&!Number.isNaN(content.startSeconds)){
398
- this.first_seek_time = content.startSeconds;
399
- }
400
- else{
401
- this.first_seek_time = -1;
402
- }
403
- if(typeof content.endSeconds=="number"&&!Number.isNaN(content.endSeconds)){
404
- this.endSeconds = content.endSeconds;
405
- }
406
- else{
407
- this.endSeconds = -1;
408
- }
409
- }
410
- else if(typeof content === "string"){
411
- musicId = content;
412
- if(typeof startSeconds === "number" && !Number.isNaN(startSeconds)){
413
- this.first_seek_time = startSeconds;
414
- }
415
- else{
416
- this.first_seek_time = -1;
417
- }
418
- this.endSeconds = -1;
419
- }
420
- else{
421
- this.player.dispatchEvent(new CustomEvent("onError",{detail:{code:401}}));
422
- }
423
- if((window as any).mep_soundcloud.numericRegex.test(musicId)){
424
- this.player_widget.load(`https://api.soundcloud.com/tracks/${String(musicId)}`,url_params,this.#ready_function);
425
- }
426
- else{
427
- this.player_widget.load(`https://soundcloud.com/${String(musicId)}`,url_params,this.#ready_function);
428
- }
429
- this.retry_count = 0;
430
- this.forse_pause = false;
431
- this.#ready_function(true);
432
- }
433
- /**
434
- * Load a new video into the player.With autoplay
435
- * @param {mep_soundcloud_load_object} content
436
- * @param {number} startSeconds
437
- */
438
- loadVideoById(content: mep_soundcloud_load_object | string, startSeconds: number){
439
- this.#musicLoader(content,startSeconds,true);
440
- }
441
- /**
442
- * Load a new video into the player.Without autoplay
443
- * @param {mep_soundcloud_load_object} content
444
- * @param {number} startSeconds
445
- */
446
- cueVideoById(content: mep_soundcloud_load_object | string, startSeconds: number){
447
- this.#musicLoader(content,startSeconds,false);
448
- }
449
- }
450
- (window as any).mep_soundcloud = mep_soundcloud;