myetv-player 1.7.1 → 1.7.2

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.
@@ -0,0 +1,87 @@
1
+ # 🧩 MYETV Video Loader Plugin
2
+
3
+ The **Video Loader Plugin** is an advanced Splash Screen / Engine Loader for the MYETV Video Player. It is designed to block the initialization queue (Pipeline) of the core player and all third-party plugins (like YouTube, Vimeo, Twitch), showing a timed loading video before revealing the main content.
4
+
5
+ ## ✨ Architectural Features
6
+
7
+ * **Async Queue (Blocking Pipeline):** Leverages `Promise`s to freeze the boot sequence of the main player. No external iframe is generated in the DOM until the loader explicitly grants the unlock.
8
+ * **TOS Compliant:** Includes a customizable text label overlay to differentiate the system video from a commercial ad, ensuring strict legal compliance with any TOS.
9
+ * **Android WebView Fix:** Natively injects a 1x1 transparent Base64 pixel as a `poster` to inhibit the intrusive behavior of Android WebView (which would otherwise brutally draw a giant native Play icon during the buffering phase).
10
+ * **"Seamless" Transition:** Unlocks the loading queue a fraction of a second before starting the fade-out transition, allowing external players to load their iframes invisibly underneath the black background, completely avoiding visual flashes.
11
+ * **Autoplay Fallback:** Automatically handles strict browser policies by catching the promise rejection and restarting the loading video in muted mode if autoplay with audio is blocked.
12
+
13
+ ---
14
+
15
+ ## 🚀 Installation
16
+
17
+ Make sure to load the plugin file in the HTML page **after** the core player script, but **before** initializing the player instance.
18
+
19
+ ```html
20
+ <script src="path/to/myetv-player.js"></script>
21
+
22
+ <script src="path/to/myetv-video-loading-plugin.js"></script>
23
+
24
+ ```
25
+
26
+ ---
27
+
28
+ ## 🛠️ Configuration and Usage
29
+
30
+ The plugin must be declared inside the `plugins` object during the initialization of the `MYETVvideoplayer`.
31
+ It is **mandatory** to assign the option `order: 1` to guarantee it is the absolute first plugin to be read and executed by the Pipeline.
32
+
33
+ ```javascript
34
+ const player1 = new MYETVvideoplayer('myetvHTML5video', {
35
+ autoplay: true,
36
+ // ... other core options ...
37
+
38
+ plugins: {
39
+
40
+ // 1. ENGINE LOADER (Must be order: 1)
41
+ videoloader: {
42
+ order: 1,
43
+ videoUrl: '[https://www.myetv.tv/CDN/videos/MYETV_Video_Loading_Player.mp4](https://www.myetv.tv/CDN/videos/MYETV_Video_Loading_Player.mp4)',
44
+ timeout: 3000,
45
+ backgroundColor: '#000000',
46
+ muted: true,
47
+ loadingText: 'MYETV Engine Loading...'
48
+ },
49
+
50
+ // 2. THIRD-PARTY PLUGINS (No order needed, default to 99)
51
+ youtube: {
52
+ // YouTube initialization will wait until the videoloader resolves
53
+ apiKey: 'YOUR_API_KEY',
54
+ videoId: 'VIDEO_ID',
55
+ autoplay: true,
56
+ quality: 'auto'
57
+ }
58
+ }
59
+ });
60
+
61
+ ```
62
+
63
+ ---
64
+
65
+ ## ⚙️ Plugin Options
66
+
67
+ The following options can be passed inside the `videoloader` object to customize its behavior:
68
+
69
+ | Option | Type | Default | Description |
70
+ | --- | --- | --- | --- |
71
+ | `order` | `Number` | `99` | **Mandatory to set it to `1**`. Defines the priority in the core player's loading Pipeline. |
72
+ | `videoUrl` | `String` | `null` | The direct URL of the video (supported: `.mp4`,`.webm`,`all videos`,`.webp`,`.gif`,`.png`,`.jpg`) to use as the loading screen. If left null, the plugin skips execution, instantly unlocking the queue. |
73
+ | `timeout` | `Number` | `3000` | Exact duration (in milliseconds) to display the loader before unlocking the main player. |
74
+ | `backgroundColor` | `String` | `'#000'` | Background color of the overlay behind the loading video. It completely covers the underlying DOM. |
75
+ | `muted` | `Boolean` | `true` | If `true`, the loading video plays without audio. It is **strongly recommended** to leave it as `true` to prevent modern browsers from blocking the page's autoplay. |
76
+ | `loadingText` | `String` | `'Loading engine...'` | Text shown in the bottom right corner. Crucial for third-party TOS compliance to let the user know this is a system screen and not an ad. |
77
+
78
+ ---
79
+
80
+ ## 🧠 Execution Flow (Under the hood)
81
+
82
+ 1. The core `myetv-player.js` initializes the `loadPluginsSequentially()` async function.
83
+ 2. It finds `videoloader` with `order: 1` and executes `await pluginInstance.waitForCompletion()`. The execution of the entire main player **halts**.
84
+ 3. The plugin creates the HTML tags, inserts the transparent pixel against the Android WebView flash, and plays the video in a loop for the milliseconds defined in `timeout`.
85
+ 4. When the timeout expires, the plugin calls `resolvePromise()`: the main player resumes the loop and can now instantiate the next plugins (e.g., YouTube or other).
86
+ 5. After a `500ms` CSS fade-out transition, the loader completely destroys its own HTML nodes and frees the RAM (`removeChild`, `removeAttribute('src')`).
87
+ 6. The player is now fully operational.