You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.3 KiB
95 lines
2.3 KiB
import { BrowserWindow } from 'electron'; |
|
import { ICON, WEB_URL, WIN_CONFIG, preload, url } from '../main/constant'; |
|
|
|
let viewVideoWin: BrowserWindow | null = null; |
|
|
|
function createViewVideoWin(search?: any): BrowserWindow { |
|
viewVideoWin = new BrowserWindow({ |
|
title: '视频', |
|
icon: ICON, |
|
autoHideMenuBar: WIN_CONFIG.viewVideo.autoHideMenuBar, // 自动隐藏菜单栏 |
|
webPreferences: { |
|
preload, |
|
}, |
|
}); |
|
|
|
const videoUrl = search?.videoUrl || ''; |
|
const recordId = search?.recordId || ''; |
|
// Open devTool if the app is not packaged |
|
// viewVideoWin.webContents.openDevTools(); |
|
if (url) { |
|
viewVideoWin.loadURL( |
|
WEB_URL + |
|
`viewVideo.html?${videoUrl ? 'videoUrl=' + videoUrl : ''}${ |
|
recordId ? 'recordId=' + recordId : '' |
|
}`, |
|
); |
|
} else { |
|
viewVideoWin.loadFile(WIN_CONFIG.viewVideo.html, { |
|
search: `?${videoUrl ? 'videoUrl=' + videoUrl : ''}${recordId ? 'recordId=' + recordId : ''}`, |
|
}); |
|
} |
|
|
|
viewVideoWin.once('ready-to-show', async () => { |
|
viewVideoWin?.show(); |
|
}); |
|
|
|
return viewVideoWin; |
|
} |
|
|
|
function openViewVideoWin(search?: any) { |
|
if (!viewVideoWin || viewVideoWin?.isDestroyed()) { |
|
viewVideoWin = createViewVideoWin(search); |
|
} |
|
viewVideoWin.show(); |
|
} |
|
|
|
function closeViewVideoWin() { |
|
if (!(viewVideoWin && viewVideoWin.isDestroyed())) { |
|
viewVideoWin?.close(); |
|
} |
|
viewVideoWin = null; |
|
} |
|
|
|
function hideViewVideoWin() { |
|
viewVideoWin?.hide(); |
|
} |
|
|
|
function minimizeViewVideoWin() { |
|
viewVideoWin?.minimize(); |
|
} |
|
|
|
function maximizeViewVideoWin() { |
|
viewVideoWin?.maximize(); |
|
} |
|
|
|
function unmaximizeViewVideoWin() { |
|
viewVideoWin?.unmaximize(); |
|
} |
|
|
|
function setAlwaysOnTopViewVideoWin(isAlwaysOnTop: boolean) { |
|
viewVideoWin?.setAlwaysOnTop(isAlwaysOnTop); |
|
} |
|
|
|
async function getHistoryVideoPath() { |
|
// const historyVideoPath = ((await getHistoryVideo()) as string) || ''; |
|
// return historyVideoPath; |
|
} |
|
|
|
async function sendHistoryVideo() { |
|
// const filePath = await getHistoryVideoPath(); |
|
// let video = await readDirectoryVideo(filePath); |
|
// return video; |
|
} |
|
|
|
export { |
|
closeViewVideoWin, |
|
createViewVideoWin, |
|
hideViewVideoWin, |
|
maximizeViewVideoWin, |
|
minimizeViewVideoWin, |
|
openViewVideoWin, |
|
sendHistoryVideo, |
|
setAlwaysOnTopViewVideoWin, |
|
unmaximizeViewVideoWin, |
|
};
|
|
|