unified-video-framework 1.4.247 → 1.4.248
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.
|
@@ -1129,10 +1129,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
1129
1129
|
private youtubePlayer: any = null;
|
|
1130
1130
|
private youtubePlayerReady: boolean = false;
|
|
1131
1131
|
private youtubeIframe: HTMLIFrameElement | null = null;
|
|
1132
|
-
private isYoutubePiPActive: boolean = false;
|
|
1133
|
-
private youtubePiPContainer: HTMLDivElement | null = null;
|
|
1134
|
-
private youtubePiPOriginalParent: HTMLElement | null = null;
|
|
1135
|
-
private youtubePiPOriginalPosition: string = '';
|
|
1136
1132
|
|
|
1137
1133
|
private async createYouTubePlayer(videoId: string): Promise<void> {
|
|
1138
1134
|
const container = this.playerWrapper || this.video?.parentElement;
|
|
@@ -9120,17 +9116,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
9120
9116
|
|
|
9121
9117
|
private async togglePiP(): Promise<void> {
|
|
9122
9118
|
try {
|
|
9123
|
-
// Handle YouTube player with custom PiP
|
|
9124
|
-
if (this.youtubePlayer && this.youtubePlayerReady) {
|
|
9125
|
-
if (this.isYoutubePiPActive) {
|
|
9126
|
-
await this.exitYoutubePiP();
|
|
9127
|
-
} else {
|
|
9128
|
-
await this.enterYoutubePiP();
|
|
9129
|
-
}
|
|
9130
|
-
return;
|
|
9131
|
-
}
|
|
9132
|
-
|
|
9133
|
-
// Native PiP for regular video
|
|
9134
9119
|
if ((document as any).pictureInPictureElement) {
|
|
9135
9120
|
await this.exitPictureInPicture();
|
|
9136
9121
|
} else {
|
|
@@ -9141,137 +9126,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
9141
9126
|
}
|
|
9142
9127
|
}
|
|
9143
9128
|
|
|
9144
|
-
private async enterYoutubePiP(): Promise<void> {
|
|
9145
|
-
try {
|
|
9146
|
-
const playerWrapper = this.playerWrapper || this.container?.querySelector('.uvf-player-wrapper');
|
|
9147
|
-
if (!playerWrapper) {
|
|
9148
|
-
this.showNotification('Player container not found');
|
|
9149
|
-
return;
|
|
9150
|
-
}
|
|
9151
|
-
|
|
9152
|
-
// Store original position
|
|
9153
|
-
this.youtubePiPOriginalParent = playerWrapper.parentElement;
|
|
9154
|
-
this.youtubePiPOriginalPosition = playerWrapper.getAttribute('style') || '';
|
|
9155
|
-
|
|
9156
|
-
// Create PiP container
|
|
9157
|
-
this.youtubePiPContainer = document.createElement('div');
|
|
9158
|
-
this.youtubePiPContainer.id = 'youtube-pip-container';
|
|
9159
|
-
this.youtubePiPContainer.style.cssText = `
|
|
9160
|
-
position: fixed;
|
|
9161
|
-
bottom: 20px;
|
|
9162
|
-
right: 20px;
|
|
9163
|
-
width: 400px;
|
|
9164
|
-
height: 225px;
|
|
9165
|
-
z-index: 9999;
|
|
9166
|
-
background: #000;
|
|
9167
|
-
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
9168
|
-
border-radius: 8px;
|
|
9169
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
|
|
9170
|
-
cursor: grab;
|
|
9171
|
-
overflow: hidden;
|
|
9172
|
-
`;
|
|
9173
|
-
|
|
9174
|
-
// Add drag functionality
|
|
9175
|
-
let isDragging = false;
|
|
9176
|
-
let offset = { x: 0, y: 0 };
|
|
9177
|
-
|
|
9178
|
-
this.youtubePiPContainer.addEventListener('mousedown', (e) => {
|
|
9179
|
-
if ((e.target as HTMLElement).closest('.youtube-pip-controls')) return;
|
|
9180
|
-
isDragging = true;
|
|
9181
|
-
offset.x = e.clientX - this.youtubePiPContainer!.getBoundingClientRect().left;
|
|
9182
|
-
offset.y = e.clientY - this.youtubePiPContainer!.getBoundingClientRect().top;
|
|
9183
|
-
this.youtubePiPContainer!.style.cursor = 'grabbing';
|
|
9184
|
-
});
|
|
9185
|
-
|
|
9186
|
-
document.addEventListener('mousemove', (e) => {
|
|
9187
|
-
if (!isDragging || !this.youtubePiPContainer) return;
|
|
9188
|
-
this.youtubePiPContainer.style.left = (e.clientX - offset.x) + 'px';
|
|
9189
|
-
this.youtubePiPContainer.style.top = (e.clientY - offset.y) + 'px';
|
|
9190
|
-
});
|
|
9191
|
-
|
|
9192
|
-
document.addEventListener('mouseup', () => {
|
|
9193
|
-
isDragging = false;
|
|
9194
|
-
if (this.youtubePiPContainer) this.youtubePiPContainer.style.cursor = 'grab';
|
|
9195
|
-
});
|
|
9196
|
-
|
|
9197
|
-
// Add close button
|
|
9198
|
-
const closeBtn = document.createElement('button');
|
|
9199
|
-
closeBtn.className = 'youtube-pip-controls';
|
|
9200
|
-
closeBtn.innerHTML = '✕';
|
|
9201
|
-
closeBtn.style.cssText = `
|
|
9202
|
-
position: absolute;
|
|
9203
|
-
top: 8px;
|
|
9204
|
-
right: 8px;
|
|
9205
|
-
width: 32px;
|
|
9206
|
-
height: 32px;
|
|
9207
|
-
background: rgba(255, 255, 255, 0.2);
|
|
9208
|
-
border: none;
|
|
9209
|
-
color: white;
|
|
9210
|
-
font-size: 18px;
|
|
9211
|
-
border-radius: 4px;
|
|
9212
|
-
cursor: pointer;
|
|
9213
|
-
z-index: 10000;
|
|
9214
|
-
transition: background 0.2s;
|
|
9215
|
-
`;
|
|
9216
|
-
|
|
9217
|
-
closeBtn.addEventListener('hover', () => {
|
|
9218
|
-
closeBtn.style.background = 'rgba(255, 255, 255, 0.4)';
|
|
9219
|
-
});
|
|
9220
|
-
|
|
9221
|
-
closeBtn.addEventListener('click', async () => {
|
|
9222
|
-
await this.exitYoutubePiP();
|
|
9223
|
-
});
|
|
9224
|
-
|
|
9225
|
-
// Move player to PiP container
|
|
9226
|
-
this.youtubePiPContainer.appendChild(playerWrapper as HTMLElement);
|
|
9227
|
-
this.youtubePiPContainer.appendChild(closeBtn);
|
|
9228
|
-
document.body.appendChild(this.youtubePiPContainer);
|
|
9229
|
-
|
|
9230
|
-
// Style player for PiP
|
|
9231
|
-
(playerWrapper as HTMLElement).style.width = '100%';
|
|
9232
|
-
(playerWrapper as HTMLElement).style.height = '100%';
|
|
9233
|
-
|
|
9234
|
-
this.isYoutubePiPActive = true;
|
|
9235
|
-
this.showNotification('PiP mode active (drag to move)');
|
|
9236
|
-
this.debugLog('YouTube PiP mode enabled');
|
|
9237
|
-
} catch (error) {
|
|
9238
|
-
this.debugError('Failed to enter YouTube PiP:', error);
|
|
9239
|
-
this.showNotification('PiP mode failed');
|
|
9240
|
-
}
|
|
9241
|
-
}
|
|
9242
|
-
|
|
9243
|
-
private async exitYoutubePiP(): Promise<void> {
|
|
9244
|
-
try {
|
|
9245
|
-
if (!this.youtubePiPContainer || !this.youtubePiPOriginalParent) {
|
|
9246
|
-
return;
|
|
9247
|
-
}
|
|
9248
|
-
|
|
9249
|
-
const playerWrapper = this.playerWrapper || this.container?.querySelector('.uvf-player-wrapper');
|
|
9250
|
-
if (playerWrapper) {
|
|
9251
|
-
// Restore original styling
|
|
9252
|
-
if (this.youtubePiPOriginalPosition) {
|
|
9253
|
-
playerWrapper.setAttribute('style', this.youtubePiPOriginalPosition);
|
|
9254
|
-
} else {
|
|
9255
|
-
playerWrapper.removeAttribute('style');
|
|
9256
|
-
}
|
|
9257
|
-
|
|
9258
|
-
// Move back to original parent
|
|
9259
|
-
this.youtubePiPOriginalParent.appendChild(playerWrapper);
|
|
9260
|
-
}
|
|
9261
|
-
|
|
9262
|
-
// Remove PiP container
|
|
9263
|
-
this.youtubePiPContainer.remove();
|
|
9264
|
-
this.youtubePiPContainer = null;
|
|
9265
|
-
this.youtubePiPOriginalParent = null;
|
|
9266
|
-
|
|
9267
|
-
this.isYoutubePiPActive = false;
|
|
9268
|
-
this.showNotification('PiP mode closed');
|
|
9269
|
-
this.debugLog('YouTube PiP mode disabled');
|
|
9270
|
-
} catch (error) {
|
|
9271
|
-
this.debugError('Failed to exit YouTube PiP:', error);
|
|
9272
|
-
}
|
|
9273
|
-
}
|
|
9274
|
-
|
|
9275
9129
|
private setupCastContextSafe(): void {
|
|
9276
9130
|
try {
|
|
9277
9131
|
const castNs = (window as any).cast;
|