Files
go2rtc/www
2023-01-02 16:33:00 +03:00
..
2022-09-18 17:37:44 +03:00
2022-09-01 16:11:34 +03:00
2022-09-01 16:11:34 +03:00
2022-09-01 16:11:34 +03:00
2022-11-11 22:44:54 +03:00
2022-09-01 16:11:34 +03:00
2022-08-18 09:19:00 +03:00
2022-12-18 22:38:44 +03:00

HTML5

1. Autoplay video tag

Video auto play is not working

Recently many browsers can only autoplay the videos with sound off, so you'll need to add muted attribute to the video tag too


<video id="video" autoplay controls playsinline muted></video>

2. [Safari] pc.createOffer

Don't work in Desktop Safari:

pc.createOffer({offerToReceiveAudio: true, offerToReceiveVideo: true})

Should be replaced with:

pc.addTransceiver('video', {direction: 'recvonly'});
pc.addTransceiver('audio', {direction: 'recvonly'});
pc.createOffer();

3. pc.ontrack

TODO

pc.ontrack = ev => {
    const video = document.getElementById('video');

    // when audio track not exist in Chrome
    if (ev.streams.length === 0) return;

    // when audio track not exist in Firefox
    if (ev.streams[0].id[0] === '{') return;

    // when stream already init
    if (video.srcObject !== null) return;

    video.srcObject = ev.streams[0];
}