myetv-player 1.2.0 → 1.3.0
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/css/myetv-player.css +131 -0
- package/css/myetv-player.min.css +1 -1
- package/dist/myetv-player.js +547 -102
- package/dist/myetv-player.min.js +486 -93
- package/package.json +35 -17
- package/plugins/twitch/myetv-player-twitch-plugin.js +125 -11
- package/plugins/vimeo/myetv-player-vimeo.js +80 -49
- package/plugins/youtube/README.md +5 -2
- package/plugins/youtube/myetv-player-youtube-plugin.js +766 -6
- package/.github/workflows/codeql.yml +0 -100
- package/.github/workflows/npm-publish.yml +0 -30
- package/SECURITY.md +0 -50
- package/build.js +0 -195
- package/scss/README.md +0 -161
- package/scss/_audio-player.scss +0 -21
- package/scss/_base.scss +0 -116
- package/scss/_controls.scss +0 -204
- package/scss/_loading.scss +0 -111
- package/scss/_menus.scss +0 -432
- package/scss/_mixins.scss +0 -112
- package/scss/_poster.scss +0 -8
- package/scss/_progress-bar.scss +0 -319
- package/scss/_resolution.scss +0 -68
- package/scss/_responsive.scss +0 -1368
- package/scss/_themes.scss +0 -30
- package/scss/_title-overlay.scss +0 -60
- package/scss/_tooltips.scss +0 -7
- package/scss/_variables.scss +0 -49
- package/scss/_video.scss +0 -221
- package/scss/_volume.scss +0 -122
- package/scss/_watermark.scss +0 -128
- package/scss/myetv-player.scss +0 -51
- package/scss/package.json +0 -16
- package/src/README.md +0 -560
- package/src/chapters.js +0 -521
- package/src/controls.js +0 -1242
- package/src/core.js +0 -1922
- package/src/events.js +0 -537
- package/src/fullscreen.js +0 -82
- package/src/i18n.js +0 -374
- package/src/playlist.js +0 -177
- package/src/plugins.js +0 -384
- package/src/quality.js +0 -963
- package/src/streaming.js +0 -346
- package/src/subtitles.js +0 -524
- package/src/utils.js +0 -65
- package/src/watermark.js +0 -246
package/src/watermark.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
// Watermark Module for MYETV Video Player
|
|
2
|
-
// Displays a logo overlay on the video with customizable position and link
|
|
3
|
-
// Created by https://www.myetv.tv https://oskarcosimo.com
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Initialize watermark overlay
|
|
7
|
-
* Creates a watermark element overlaid on the video player
|
|
8
|
-
*/
|
|
9
|
-
initializeWatermark() {
|
|
10
|
-
if (!this.options.watermarkUrl) {
|
|
11
|
-
if (this.options.debug) console.log('🏷️ Watermark disabled - no URL provided');
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (this.options.debug) console.log('🏷️ Initializing watermark overlay');
|
|
16
|
-
|
|
17
|
-
// Create watermark container
|
|
18
|
-
const watermark = document.createElement('div');
|
|
19
|
-
watermark.className = 'video-watermark';
|
|
20
|
-
|
|
21
|
-
// Set position class - FIX: use template literal correctly
|
|
22
|
-
const position = this.options.watermarkPosition || 'bottomright';
|
|
23
|
-
watermark.classList.add(`watermark-${position}`); // ← FIX QUI
|
|
24
|
-
|
|
25
|
-
// Add hide-on-autohide class if option is enabled
|
|
26
|
-
if (this.options.hideWatermark) {
|
|
27
|
-
watermark.classList.add('hide-on-autohide');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Create watermark image
|
|
31
|
-
const watermarkImg = document.createElement('img');
|
|
32
|
-
watermarkImg.src = this.options.watermarkUrl;
|
|
33
|
-
watermarkImg.alt = 'Watermark';
|
|
34
|
-
|
|
35
|
-
// Add title/tooltip if provided
|
|
36
|
-
if (this.options.watermarkTitle) {
|
|
37
|
-
watermarkImg.title = this.options.watermarkTitle;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Handle image loading error
|
|
41
|
-
watermarkImg.onerror = () => {
|
|
42
|
-
if (this.options.debug) console.warn('🏷️ Watermark image failed to load:', this.options.watermarkUrl);
|
|
43
|
-
watermark.style.display = 'none';
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
watermarkImg.onload = () => {
|
|
47
|
-
if (this.options.debug) console.log('🏷️ Watermark image loaded successfully');
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// Add click handler if link URL is provided
|
|
51
|
-
if (this.options.watermarkLink) {
|
|
52
|
-
watermark.style.cursor = 'pointer';
|
|
53
|
-
watermark.addEventListener('click', (e) => {
|
|
54
|
-
e.stopPropagation(); // Prevent video controls interference
|
|
55
|
-
window.open(this.options.watermarkLink, '_blank', 'noopener,noreferrer');
|
|
56
|
-
if (this.options.debug) console.log('🏷️ Watermark clicked, opening:', this.options.watermarkLink);
|
|
57
|
-
});
|
|
58
|
-
} else {
|
|
59
|
-
watermark.style.cursor = 'default';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Append image to watermark container
|
|
63
|
-
watermark.appendChild(watermarkImg);
|
|
64
|
-
|
|
65
|
-
// Insert watermark before controls (above video, below controls)
|
|
66
|
-
if (this.controls) {
|
|
67
|
-
this.container.insertBefore(watermark, this.controls);
|
|
68
|
-
} else {
|
|
69
|
-
this.container.appendChild(watermark);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Store reference to watermark element
|
|
73
|
-
// Store reference to watermark element
|
|
74
|
-
this.watermarkElement = watermark;
|
|
75
|
-
|
|
76
|
-
// Set initial position
|
|
77
|
-
this.updateWatermarkPosition();
|
|
78
|
-
|
|
79
|
-
// Update position on window resize
|
|
80
|
-
this.watermarkResizeHandler = () => {
|
|
81
|
-
this.updateWatermarkPosition();
|
|
82
|
-
};
|
|
83
|
-
window.addEventListener('resize', this.watermarkResizeHandler);
|
|
84
|
-
|
|
85
|
-
if (this.options.debug) {
|
|
86
|
-
console.log('🏷️ Watermark created:', {
|
|
87
|
-
url: this.options.watermarkUrl,
|
|
88
|
-
link: this.options.watermarkLink || 'none',
|
|
89
|
-
position: position,
|
|
90
|
-
title: this.options.watermarkTitle || 'none',
|
|
91
|
-
hideWithControls: this.options.hideWatermark
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Set or update watermark configuration
|
|
98
|
-
* @param {string} url - URL of the watermark image
|
|
99
|
-
* @param {string} link - Optional URL to open when watermark is clicked
|
|
100
|
-
* @param {string} position - Position of watermark (topleft, topright, bottomleft, bottomright)
|
|
101
|
-
* @param {string} title - Optional tooltip title for the watermark
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
setWatermark(url, link = '', position = 'bottomright', title = '') {
|
|
105
|
-
// Update options
|
|
106
|
-
this.options.watermarkUrl = url;
|
|
107
|
-
this.options.watermarkLink = link;
|
|
108
|
-
this.options.watermarkPosition = position;
|
|
109
|
-
this.options.watermarkTitle = title;
|
|
110
|
-
|
|
111
|
-
// Remove existing watermark if present
|
|
112
|
-
if (this.watermarkElement) {
|
|
113
|
-
this.watermarkElement.remove();
|
|
114
|
-
this.watermarkElement = null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Recreate watermark if URL is provided
|
|
118
|
-
if (url) {
|
|
119
|
-
this.initializeWatermark();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Remove watermark from player
|
|
127
|
-
*/
|
|
128
|
-
removeWatermark() {
|
|
129
|
-
if (this.watermarkElement) {
|
|
130
|
-
this.watermarkElement.remove();
|
|
131
|
-
this.watermarkElement = null;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Remove resize listener
|
|
135
|
-
if (this.watermarkResizeHandler) {
|
|
136
|
-
window.removeEventListener('resize', this.watermarkResizeHandler);
|
|
137
|
-
this.watermarkResizeHandler = null;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
this.options.watermarkUrl = '';
|
|
141
|
-
this.options.watermarkLink = '';
|
|
142
|
-
this.options.watermarkPosition = 'bottomright';
|
|
143
|
-
this.options.watermarkTitle = '';
|
|
144
|
-
|
|
145
|
-
if (this.options.debug) console.log('🏷️ Watermark removed');
|
|
146
|
-
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Update watermark position
|
|
152
|
-
* @param {string} position - New position (topleft, topright, bottomleft, bottomright)
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
setWatermarkPosition(position) {
|
|
156
|
-
if (!['topleft', 'topright', 'bottomleft', 'bottomright'].includes(position)) {
|
|
157
|
-
if (this.options.debug) console.warn('🏷️ Invalid watermark position:', position);
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
this.options.watermarkPosition = position;
|
|
162
|
-
|
|
163
|
-
if (this.watermarkElement) {
|
|
164
|
-
// Remove all position classes
|
|
165
|
-
this.watermarkElement.classList.remove(
|
|
166
|
-
'watermark-topleft',
|
|
167
|
-
'watermark-topright',
|
|
168
|
-
'watermark-bottomleft',
|
|
169
|
-
'watermark-bottomright'
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
// Add new position class - FIX: use template literal correctly
|
|
173
|
-
this.watermarkElement.classList.add(`watermark-${position}`); // ← FIX QUI
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (this.options.debug) console.log('🏷️ Watermark position updated to:', position);
|
|
177
|
-
|
|
178
|
-
return this;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Update watermark position based on current controlbar height
|
|
183
|
-
* Called during window resize to keep watermark above controlbar
|
|
184
|
-
*/
|
|
185
|
-
updateWatermarkPosition() {
|
|
186
|
-
if (!this.watermarkElement) return;
|
|
187
|
-
if (!this.controls) return;
|
|
188
|
-
|
|
189
|
-
const position = this.options.watermarkPosition || 'bottomright';
|
|
190
|
-
|
|
191
|
-
// Only update bottom positions (top positions don't need adjustment)
|
|
192
|
-
if (position === 'bottomleft' || position === 'bottomright') {
|
|
193
|
-
const controlsHeight = this.controls.offsetHeight;
|
|
194
|
-
const spacing = 15; // Same spacing used in CSS
|
|
195
|
-
const bottomValue = controlsHeight + spacing;
|
|
196
|
-
|
|
197
|
-
// Check if controls are visible
|
|
198
|
-
const hasControls = this.container.classList.contains('has-controls');
|
|
199
|
-
|
|
200
|
-
if (hasControls || !this.options.hideWatermark) {
|
|
201
|
-
// Position above controlbar
|
|
202
|
-
this.watermarkElement.style.bottom = `${bottomValue}px`;
|
|
203
|
-
} else {
|
|
204
|
-
// Position at bottom corner when controls hidden
|
|
205
|
-
this.watermarkElement.style.bottom = '15px';
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (this.options.debug) {
|
|
209
|
-
console.log(`🏷️ Watermark position updated: bottom ${this.watermarkElement.style.bottom}`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Set whether watermark should hide with controls
|
|
216
|
-
* @param {boolean} hide - True to hide watermark with controls, false to keep always visible
|
|
217
|
-
*/
|
|
218
|
-
setWatermarkAutoHide(hide) {
|
|
219
|
-
this.options.hideWatermark = hide;
|
|
220
|
-
|
|
221
|
-
if (this.watermarkElement) {
|
|
222
|
-
if (hide) {
|
|
223
|
-
this.watermarkElement.classList.add('hide-on-autohide');
|
|
224
|
-
} else {
|
|
225
|
-
this.watermarkElement.classList.remove('hide-on-autohide');
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (this.options.debug) console.log('🏷️ Watermark auto-hide set to:', hide);
|
|
230
|
-
|
|
231
|
-
return this;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Get current watermark settings
|
|
236
|
-
* @returns {object} Current watermark configuration
|
|
237
|
-
*/
|
|
238
|
-
getWatermarkSettings() {
|
|
239
|
-
return {
|
|
240
|
-
url: this.options.watermarkUrl || '',
|
|
241
|
-
link: this.options.watermarkLink || '',
|
|
242
|
-
position: this.options.watermarkPosition || 'bottomright',
|
|
243
|
-
title: this.options.watermarkTitle || '',
|
|
244
|
-
hideWithControls: this.options.hideWatermark
|
|
245
|
-
};
|
|
246
|
-
}
|