/** * * @param src 视频路径 * @returns Promise - 视频的总长度 */ export const videoLodingNumFu = (src: string): Promise => { return new Promise((resolve, reject) => { const req = new XMLHttpRequest() req.open('HEAD', src, true) req.onreadystatechange = function () { if (req.readyState === 4) { if (req.status === 200) { const contentLength = req.getResponseHeader('Content-Length') if (contentLength) { const videoLength = parseInt(contentLength, 10) resolve(videoLength) } } } } req.send() }) } export const domDelOwnFu = (classNmae: string) => { const dom = document.querySelector(classNmae) if (dom) dom.remove() }