aboutsummaryrefslogtreecommitdiff
path: root/web/js/video.mjs
blob: 59cde1e7aeb16267dddf2f9cca3bc9df20bbbbec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const videoElement = `<video id="videotest" width="0" height="0" src="/.within.website/x/cmd/anubis/static/testdata/black.mp4"></video>`;

export const testVideo = async (testarea) => {
  testarea.innerHTML = videoElement;
  return (await new Promise((resolve) => {
    const video = document.getElementById('videotest');
    video.oncanplay = () => {
      testarea.style.display = "none";
      resolve(true);
    };
    video.onerror = (ev) => {
      testarea.style.display = "none";
      resolve(false);
    };
  }));
};