Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Multi-stream WebRTC application not working on Safari

I have a custom WebRTC application that uses two video streams and one audio stream.

Everything is working nicely on Chrome (93.0) and Firefox (92.0), but Safari (14.1) refuses to play one of the streams (the one for the first video element with ID "stream").

HTML looks as follows (mostly placeholders):

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <link rel="icon" href="data:;base64,iVBORw0KGgo="/>
    <script src="stream.js"></script>
    <style>
    </style>
  </head>

  <body>
    <div style="display:grid">
      <video style="grid-column:1;grid-row:1;width:720px;z-index:5" id="stream" autoplay playsinline>Your browser does not support video</video>
      <canvas style="grid-column:1;grid-row:1;justify-self:end;width:1280px;height:720px;z-index:10" id="canvas"></canvas>
      <video style="grid-column:1;grid-row:1;justify-self:end;width:1280px;height:720px" id="stream2" autoplay playsinline>Your browser does not support video</video>
    </div>
  </body>
</html>

The relevant part of the Javascript code (html5VideoElement == ID "stream", html5VideoElement2 == ID "stream2"):

function onAddRemoteStream(event) {
  if (event.transceiver.mid == remotemap["front"]) {
    frontstream.addTrack(event.track);
    html5VideoElement.srcObject = frontstream;
    html5VideoElement.play();
  }
  if (event.transceiver.mid == remotemap["audio"]) {
    frontstream.addTrack(event.track);
  }
  if (event.transceiver.mid == remotemap["surface"]) {
    surfacestream.addTrack(event.track);
    html5VideoElement2.srcObject = surfacestream;
    html5VideoElement2.play();
  }
}

onAddRemoteStream is the onTrack method for the RTCPeerConnection object. remotemap contains a mapping from track type to MID value, sent by the remote peer. frontstream and surfacestream are two (initially empty) MediaStream objects.

Weirdly enough, there are no exceptions or warnings with any browser, the first video element just stays empty and silent with Safari.

All outgoing streams (camera, audio, canvas) work on all three browsers.

Any suggestions welcome!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda