fix(video-mobile): 工作区预览固定高度并强制inline播放
This commit is contained in:
1 parent
60118d6b2c
commit
432746daf9
2 files changed
+35
-5
No files matched your search
@@ -1066,15 +1066,32 @@ html[data-theme='dark'] .cache-video-item.is-active .cache-video-thumb-wrap {
|
||||
}
|
||||
|
||||
.edit-preview-wrap {
|
||||
max-height: 62vh;
|
||||
height: min(52vh, 360px);
|
||||
max-height: min(52vh, 360px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#editVideo {
|
||||
max-height: 60vh;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: min(52vh, 360px);
|
||||
}
|
||||
|
||||
.manual-merge-col .edit-preview-wrap {
|
||||
max-height: 44vh;
|
||||
height: min(40vh, 280px);
|
||||
max-height: min(40vh, 280px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#mergeVideoPreviewA,
|
||||
#mergeVideoPreviewB {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: min(40vh, 280px);
|
||||
}
|
||||
|
||||
.manual-merge-grid {
|
||||
|
||||
@@ -122,6 +122,14 @@
|
||||
return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}.${String(milli).padStart(3, '0')}`;
|
||||
}
|
||||
|
||||
function enforceInlinePlayback(videoEl) {
|
||||
if (!(videoEl instanceof HTMLVideoElement)) return;
|
||||
videoEl.playsInline = true;
|
||||
videoEl.setAttribute('playsinline', '');
|
||||
videoEl.setAttribute('webkit-playsinline', '');
|
||||
videoEl.setAttribute('x5-playsinline', 'true');
|
||||
}
|
||||
|
||||
function shortHash(value) {
|
||||
const raw = String(value || '');
|
||||
if (!raw) return '-';
|
||||
@@ -1180,10 +1188,9 @@
|
||||
const videoEl = body.querySelector('video');
|
||||
let videoUrl = '';
|
||||
if (videoEl) {
|
||||
enforceInlinePlayback(videoEl);
|
||||
videoEl.controls = true;
|
||||
videoEl.preload = 'metadata';
|
||||
videoEl.setAttribute('playsinline', '');
|
||||
videoEl.setAttribute('webkit-playsinline', '');
|
||||
const source = videoEl.querySelector('source');
|
||||
if (source && source.getAttribute('src')) {
|
||||
videoUrl = source.getAttribute('src');
|
||||
@@ -1237,6 +1244,7 @@
|
||||
editHint.classList.toggle('hidden', Boolean(safeUrl));
|
||||
}
|
||||
if (!editVideo) return;
|
||||
enforceInlinePlayback(editVideo);
|
||||
editVideo.src = safeUrl;
|
||||
editVideo.load();
|
||||
lockedFrameIndex = -1;
|
||||
@@ -1257,6 +1265,7 @@
|
||||
function bindMergeVideoA(url) {
|
||||
const safeUrl = String(url || '').trim();
|
||||
if (!mergeVideoPreviewA) return;
|
||||
enforceInlinePlayback(mergeVideoPreviewA);
|
||||
mergeVideoPreviewA.src = safeUrl;
|
||||
mergeVideoPreviewA.load();
|
||||
mergeCutMsA = 0;
|
||||
@@ -1268,6 +1277,7 @@
|
||||
function bindMergeVideoB(url) {
|
||||
const safeUrl = String(url || '').trim();
|
||||
if (!mergeVideoPreviewB) return;
|
||||
enforceInlinePlayback(mergeVideoPreviewB);
|
||||
mergeVideoPreviewB.src = safeUrl;
|
||||
mergeVideoPreviewB.load();
|
||||
mergeCutMsB = 0;
|
||||
@@ -2541,6 +2551,7 @@
|
||||
}
|
||||
|
||||
if (editVideo) {
|
||||
enforceInlinePlayback(editVideo);
|
||||
editVideo.addEventListener('loadedmetadata', () => {
|
||||
const duration = Number(editVideo.duration || 0);
|
||||
if (editDurationText) {
|
||||
@@ -2565,6 +2576,7 @@
|
||||
}
|
||||
|
||||
if (mergeVideoPreviewA) {
|
||||
enforceInlinePlayback(mergeVideoPreviewA);
|
||||
mergeVideoPreviewA.addEventListener('loadedmetadata', () => {
|
||||
const duration = Number(mergeVideoPreviewA.duration || 0);
|
||||
if (mergeDurationA) {
|
||||
@@ -2578,6 +2590,7 @@
|
||||
}
|
||||
|
||||
if (mergeVideoPreviewB) {
|
||||
enforceInlinePlayback(mergeVideoPreviewB);
|
||||
mergeVideoPreviewB.addEventListener('loadedmetadata', () => {
|
||||
const duration = Number(mergeVideoPreviewB.duration || 0);
|
||||
if (mergeDurationB) {
|
||||
|
||||
Reference in new issue
Block a user