title: PeerJS video stream not working when using iPhone - iOS to Android or iOS to iOS - Node.js
body: <p>I have been testing this program on my Mac Laptop and it has been working fine. It would show the video from MacOS to Samsung OneUI Android, and that worked. The problem is that when I use iOS (I tried from the iPhone SE 2) and connected it to my Samsung phone (Android), it would connect, but the video did not show. The space was filled for the video (meaning the connection was there), but there was no contents of the video. It WILL show its own video contents (just the iPhone SE camera contents to itself), just not the peers video, but I know I am receiving the connection (due to socket.io and PeerJS getting to the point of trying to create the video). PS: I even tried logging 'User Connected' to the console to see if they were connecting, and they were.</p>
  <p>I have tried putting the following:</p>
  <pre><code>video.playsInline = true;
  </code></pre>
  <p>Or this:</p>
  <pre><code>video. setAttribute('autoplay', '');
  video. setAttribute('muted', '');
  video. setAttribute('playsinline', '');
  </code></pre>
  <p>But it still did not work.</p>
  <p>Do any of you know how to fix this issue?</p>
  <p>Full Code (Client):</p>
  <pre><code>const socket = io('/');
  
  const videos = document.getElementById('videos');
  const myVideo = document.createElement('video');
  let alreadyDoneUsers = {};
  let myUserId = null;
  
  const myPeer = new Peer(undefined, {
      host: '/',
      port: '8090'
  });
  
  myVideo.playsInline = true;
  myVideo.muted = true;
  var getUserMedia = navigator.mediaDevices.getUserMedia || navigator.mediaDevices.webkitGetUserMedia || navigator.mediaDevices.mozGetUserMedia;
  
  getUserMedia({
      video: true,
      audio: true
  })
  .then((stream) =&gt; {
      addVideo(myVideo, stream); 
      
      myPeer.on('call', (call) =&gt; {
          call.answer(stream);
          const video = document.createElement('video');
          video.playsInline = true;
          call.on('stream', (peerStream) =&gt; {
              addVideo(video, peerStream); 
          });
          socket.on('user-disconnected', (userIdDisconnected) =&gt; {
              if (call.peer == userIdDisconnected || call.peer == myUserId) {
                  video.remove();
              }
          })
      })
      socket.on('user-connected', (userId) =&gt; {
          console.log('User Connected');
          const call = myPeer.call(userId, stream);
          const video = document.createElement('video');
          video.playsInline = true;
          call.on('stream', (peerStream) =&gt; {
              addVideo(video, peerStream); 
          });
          socket.emit('user-id-send', myUserId);
          socket.on('user-disconnected', (userIdDisconnected) =&gt; {
              if (userId == userIdDisconnected) {
                  video.remove();
                  call.close();
              }
          })
      });
  });
  
  myPeer.on('open', (id) =&gt; {
      myUserId = id;
      socket.emit('joined', ROOM_ID, id); 
  });
  
  function addVideo(video, stream) {
      video.srcObject = stream;
      video.addEventListener('loadedmetadata', () =&gt; {
          video.play(); 
      });
      videos.append(video);
  }
  </code></pre>