myetv-player 1.1.3 → 1.1.4
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 +44 -0
- package/css/myetv-player.min.css +1 -1
- package/dist/myetv-player.js +122 -51
- package/dist/myetv-player.min.js +102 -43
- package/package.json +2 -1
- package/plugins/youtube/myetv-player-youtube-plugin.js +378 -130
- package/scss/_menus.scss +49 -0
- package/src/controls.js +122 -51
package/dist/myetv-player.min.js
CHANGED
|
@@ -3107,46 +3107,87 @@ populateSettingsMenu() {
|
|
|
3107
3107
|
if (this.options.showSpeedControl) {
|
|
3108
3108
|
const speedLabel = this.t('playback_speed') || 'Playback Speed';
|
|
3109
3109
|
const currentSpeed = this.video ? this.video.playbackRate : 1;
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
<
|
|
3113
|
-
<div class="settings-
|
|
3114
|
-
<
|
|
3115
|
-
<
|
|
3116
|
-
<div class="settings-suboption ${currentSpeed === 1 ? 'active' : ''}" data-speed="1">1x</div>
|
|
3117
|
-
<div class="settings-suboption ${currentSpeed === 1.25 ? 'active' : ''}" data-speed="1.25">1.25x</div>
|
|
3118
|
-
<div class="settings-suboption ${currentSpeed === 1.5 ? 'active' : ''}" data-speed="1.5">1.5x</div>
|
|
3119
|
-
<div class="settings-suboption ${currentSpeed === 2 ? 'active' : ''}" data-speed="2">2x</div>
|
|
3110
|
+
|
|
3111
|
+
menuHTML += `
|
|
3112
|
+
<div class="settings-expandable-wrapper">
|
|
3113
|
+
<div class="settings-option expandable-trigger" data-action="speed-expand">
|
|
3114
|
+
<span class="settings-option-label">${speedLabel}: ${currentSpeed}x</span>
|
|
3115
|
+
<span class="expand-arrow">▼</span>
|
|
3120
3116
|
</div>
|
|
3121
|
-
|
|
3117
|
+
<div class="settings-expandable-content" style="display: none;">`;
|
|
3118
|
+
|
|
3119
|
+
const speeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
|
3120
|
+
speeds.forEach(speed => {
|
|
3121
|
+
const isActive = Math.abs(speed - currentSpeed) < 0.01;
|
|
3122
|
+
menuHTML += `<div class="settings-suboption ${isActive ? 'active' : ''}" data-speed="${speed}">${speed}x</div>`;
|
|
3123
|
+
});
|
|
3124
|
+
|
|
3125
|
+
menuHTML += `</div></div>`;
|
|
3122
3126
|
}
|
|
3123
3127
|
|
|
3124
3128
|
if (this.options.showSubtitles && this.textTracks && this.textTracks.length > 0) {
|
|
3125
3129
|
const subtitlesLabel = this.t('subtitles') || 'Subtitles';
|
|
3126
3130
|
const currentTrack = this.currentSubtitleTrack;
|
|
3127
|
-
const currentLabel = this.subtitlesEnabled && currentTrack
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
<span class="settings-option-label">${subtitlesLabel}</span>
|
|
3133
|
-
<span class="
|
|
3134
|
-
|
|
3135
|
-
<div class="settings-
|
|
3136
|
-
|
|
3137
|
-
</div>`;
|
|
3131
|
+
const currentLabel = this.subtitlesEnabled && currentTrack ? currentTrack.label : (this.t('subtitlesoff') || 'Off');
|
|
3132
|
+
|
|
3133
|
+
menuHTML += `
|
|
3134
|
+
<div class="settings-expandable-wrapper">
|
|
3135
|
+
<div class="settings-option expandable-trigger" data-action="subtitles-expand">
|
|
3136
|
+
<span class="settings-option-label">${subtitlesLabel}: ${currentLabel}</span>
|
|
3137
|
+
<span class="expand-arrow">▼</span>
|
|
3138
|
+
</div>
|
|
3139
|
+
<div class="settings-expandable-content" style="display: none;">`;
|
|
3140
|
+
|
|
3141
|
+
menuHTML += `<div class="settings-suboption ${!this.subtitlesEnabled ? 'active' : ''}" data-track="off">${this.t('subtitlesoff') || 'Off'}</div>`;
|
|
3138
3142
|
|
|
3139
3143
|
this.textTracks.forEach((trackData, index) => {
|
|
3140
3144
|
const isActive = this.currentSubtitleTrack === trackData.track;
|
|
3141
|
-
menuHTML += `<div class="settings-suboption ${isActive ? 'active' : ''}" data-track="${index}"
|
|
3142
|
-
${trackData.label}
|
|
3143
|
-
</div>`;
|
|
3145
|
+
menuHTML += `<div class="settings-suboption ${isActive ? 'active' : ''}" data-track="${index}">${trackData.label}</div>`;
|
|
3144
3146
|
});
|
|
3145
3147
|
|
|
3146
|
-
menuHTML +=
|
|
3148
|
+
menuHTML += `</div></div>`;
|
|
3147
3149
|
}
|
|
3148
3150
|
|
|
3149
3151
|
settingsMenu.innerHTML = menuHTML;
|
|
3152
|
+
|
|
3153
|
+
this.addSettingsMenuScrollbar();
|
|
3154
|
+
}
|
|
3155
|
+
|
|
3156
|
+
addSettingsMenuScrollbar() {
|
|
3157
|
+
const settingsMenu = this.controls?.querySelector('.settings-menu');
|
|
3158
|
+
if (!settingsMenu) return;
|
|
3159
|
+
|
|
3160
|
+
const playerHeight = this.container.offsetHeight;
|
|
3161
|
+
const maxMenuHeight = playerHeight - 100;
|
|
3162
|
+
|
|
3163
|
+
settingsMenu.style.maxHeight = `${maxMenuHeight}px`;
|
|
3164
|
+
settingsMenu.style.overflowY = 'auto';
|
|
3165
|
+
settingsMenu.style.overflowX = 'hidden';
|
|
3166
|
+
|
|
3167
|
+
if (!document.getElementById('player-settings-scrollbar-style')) {
|
|
3168
|
+
const scrollbarStyle = document.createElement('style');
|
|
3169
|
+
scrollbarStyle.id = 'player-settings-scrollbar-style';
|
|
3170
|
+
scrollbarStyle.textContent = `
|
|
3171
|
+
.settings-menu::-webkit-scrollbar {
|
|
3172
|
+
width: 6px;
|
|
3173
|
+
}
|
|
3174
|
+
.settings-menu::-webkit-scrollbar-track {
|
|
3175
|
+
background: rgba(255,255,255,0.05);
|
|
3176
|
+
border-radius: 3px;
|
|
3177
|
+
}
|
|
3178
|
+
.settings-menu::-webkit-scrollbar-thumb {
|
|
3179
|
+
background: rgba(255,255,255,0.3);
|
|
3180
|
+
border-radius: 3px;
|
|
3181
|
+
}
|
|
3182
|
+
.settings-menu::-webkit-scrollbar-thumb:hover {
|
|
3183
|
+
background: rgba(255,255,255,0.5);
|
|
3184
|
+
}
|
|
3185
|
+
`;
|
|
3186
|
+
document.head.appendChild(scrollbarStyle);
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
settingsMenu.style.scrollbarWidth = 'thin';
|
|
3190
|
+
settingsMenu.style.scrollbarColor = 'rgba(255,255,255,0.3) transparent';
|
|
3150
3191
|
}
|
|
3151
3192
|
|
|
3152
3193
|
bindSettingsMenuEvents() {
|
|
@@ -3156,6 +3197,24 @@ bindSettingsMenuEvents() {
|
|
|
3156
3197
|
settingsMenu.addEventListener('click', (e) => {
|
|
3157
3198
|
e.stopPropagation();
|
|
3158
3199
|
|
|
3200
|
+
if (e.target.classList.contains('expandable-trigger') || e.target.closest('.expandable-trigger')) {
|
|
3201
|
+
const trigger = e.target.classList.contains('expandable-trigger') ? e.target : e.target.closest('.expandable-trigger');
|
|
3202
|
+
const wrapper = trigger.closest('.settings-expandable-wrapper');
|
|
3203
|
+
const content = wrapper.querySelector('.settings-expandable-content');
|
|
3204
|
+
const arrow = trigger.querySelector('.expand-arrow');
|
|
3205
|
+
|
|
3206
|
+
const isExpanded = content.style.display !== 'none';
|
|
3207
|
+
|
|
3208
|
+
if (isExpanded) {
|
|
3209
|
+
content.style.display = 'none';
|
|
3210
|
+
arrow.style.transform = 'rotate(0deg)';
|
|
3211
|
+
} else {
|
|
3212
|
+
content.style.display = 'block';
|
|
3213
|
+
arrow.style.transform = 'rotate(180deg)';
|
|
3214
|
+
}
|
|
3215
|
+
return;
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3159
3218
|
if (e.target.classList.contains('settings-option') || e.target.closest('.settings-option')) {
|
|
3160
3219
|
const option = e.target.classList.contains('settings-option') ? e.target : e.target.closest('.settings-option');
|
|
3161
3220
|
const action = option.getAttribute('data-action');
|
|
@@ -3167,29 +3226,28 @@ bindSettingsMenuEvents() {
|
|
|
3167
3226
|
}
|
|
3168
3227
|
|
|
3169
3228
|
if (e.target.classList.contains('settings-suboption')) {
|
|
3170
|
-
const
|
|
3171
|
-
const
|
|
3229
|
+
const wrapper = e.target.closest('.settings-expandable-wrapper');
|
|
3230
|
+
const trigger = wrapper.querySelector('.expandable-trigger');
|
|
3231
|
+
const action = trigger.getAttribute('data-action');
|
|
3172
3232
|
|
|
3173
|
-
if (action === 'speed') {
|
|
3233
|
+
if (action === 'speed-expand') {
|
|
3174
3234
|
const speed = parseFloat(e.target.getAttribute('data-speed'));
|
|
3175
3235
|
if (speed && speed > 0 && this.video && !this.isChangingQuality) {
|
|
3176
3236
|
this.video.playbackRate = speed;
|
|
3177
3237
|
|
|
3178
|
-
|
|
3179
|
-
opt.classList.remove('active');
|
|
3180
|
-
});
|
|
3238
|
+
wrapper.querySelectorAll('.settings-suboption').forEach(opt => opt.classList.remove('active'));
|
|
3181
3239
|
e.target.classList.add('active');
|
|
3182
3240
|
|
|
3183
|
-
const
|
|
3184
|
-
if (
|
|
3241
|
+
const label = trigger.querySelector('.settings-option-label');
|
|
3242
|
+
if (label) {
|
|
3243
|
+
const speedLabel = this.t('playback_speed') || 'Playback Speed';
|
|
3244
|
+
label.textContent = `${speedLabel}: ${speed}x`;
|
|
3245
|
+
}
|
|
3185
3246
|
|
|
3186
3247
|
this.triggerEvent('speedchange', { speed, previousSpeed: this.video.playbackRate });
|
|
3187
3248
|
}
|
|
3188
|
-
}
|
|
3189
|
-
|
|
3190
|
-
else if (action === 'subtitles') {
|
|
3249
|
+
} else if (action === 'subtitles-expand') {
|
|
3191
3250
|
const trackData = e.target.getAttribute('data-track');
|
|
3192
|
-
|
|
3193
3251
|
if (trackData === 'off') {
|
|
3194
3252
|
this.disableSubtitles();
|
|
3195
3253
|
} else {
|
|
@@ -3197,13 +3255,14 @@ bindSettingsMenuEvents() {
|
|
|
3197
3255
|
this.enableSubtitleTrack(trackIndex);
|
|
3198
3256
|
}
|
|
3199
3257
|
|
|
3200
|
-
|
|
3201
|
-
opt.classList.remove('active');
|
|
3202
|
-
});
|
|
3258
|
+
wrapper.querySelectorAll('.settings-suboption').forEach(opt => opt.classList.remove('active'));
|
|
3203
3259
|
e.target.classList.add('active');
|
|
3204
3260
|
|
|
3205
|
-
const
|
|
3206
|
-
if (
|
|
3261
|
+
const label = trigger.querySelector('.settings-option-label');
|
|
3262
|
+
if (label) {
|
|
3263
|
+
const subtitlesLabel = this.t('subtitles') || 'Subtitles';
|
|
3264
|
+
label.textContent = `${subtitlesLabel}: ${e.target.textContent}`;
|
|
3265
|
+
}
|
|
3207
3266
|
}
|
|
3208
3267
|
}
|
|
3209
3268
|
});
|
package/package.json
CHANGED