Commit 12b57547 authored by Skye Yu's avatar Skye Yu

test:

parent 9cab57dd
import { Logger as internalLogger } from './utils/utils';
import { testAudio } from './utils/testAudio'
const QUERY_DEVICE_INFO = 0x01;
const QUERY_DEVICE_TIME = 0x02;
......@@ -701,16 +702,22 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
for (let i = 0; i < filename.length; i++) fname.push(filename.charCodeAt(i));
function visibilitychange() {
if (document.visibilityState === 'hidden') {
console.log('Page is hidden');
const audio = document.createElement('audio');
audio.src = './assets/dome.m4a';
audio.play();
let audio = document.getElementById('test_audio');
if (!audio) {
audio = document.createElement('audio');
audio.id = 'test_audio'
audio.src = testAudio;
audio.loop = true;
audio.controls = false;
audio.autoplay = true;
document.body.appendChild(audio);
}
if (document.visibilityState === 'hidden') {
console.log('Page is hidden');
audio.play();
// 可以选择暂停数据传输,或通过 Web Worker 继续后台任务
} else {
audio.pause();
console.log('Page is visible');
// 重新开始或恢复数据传输
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment