1

I am using Twilio Video for creating a video/chat application, and the remote video tracks are displayed dark on Safari IOS (Using Safari Technology Preview) as shown in the picture below. (One way video)

I was thinking the issue is with the Browsers Autoplay Policy, but i think this should not be the case, since the audio track is played, while the video track remains dark. Also, i make sure that the user presses a "Join Call" button, to ensure user interaction, which allows the rendering of a component which runs this React useEffect.

The codec of the video is H264, to ensure all Safari users can join the Room (Group Room)

  useEffect(() => {
    const canConnectToRoom = !room && !isConnectingToRoom && token && roomName

    if (canConnectToRoom) {
      connectToRoom(token, {
        video: false,
        name: roomName,
      })
    }
  }, [room, isConnectingToRoom, token, roomName, connectToRoom])

enter image description here

Any help would be appreciated, thanks.

UPDATE 1:

TO RECEIVE THE REMOTE VIDEO STREAM

1. Render a RemoteParticipant component:

The collapsed code is for rendering a fallback UI when the remote camera is disabled (This gets shown when the remote camera is disabled, but when the remote camera is enabled just a dark screen)

enter image description here

2. Extract the participant publications

enter image description here

3. Render the publication tracks as:

enter image description here

4. Render the Video Track

enter image description here

5. Warnings in Safari Console

The warnings in the console are printed out until i allow microphone access. I tried joining the room after allowing microphone access, we eliminate console warnings that way, but remote video is still dark.

enter image description here

DrSmrtnik
  • 69
  • 1
  • 8
  • You have `video: false` in your example code. Is that intentional? Does this application work in other browsers, including the current latest production version of Safari iOS (not the technical preview)? What is the code you use to add videos to the page? Do you have the `playsinline` attribute set on the video elements? – philnash Jul 27 '21 at 04:00
  • @philnash Yes that is intentional, the application is one-way video, two-way audio. (Basically we have a worker who streams his audio and video, and a consumer who streams only audio, the code and the screenshot is from the consumer side). We haven't tested on actual iOS devices (Only Safari Technology Preview), but the `twilio-video-app-react` example works on that browser, so i assume that there is an issue with my app. To display video, we attach the track to this HTML element ` – DrSmrtnik Jul 27 '21 at 07:36
  • Can you edit your question with the code you are using to receive the remote video stream and place it on the page? Also, are there any error messages logged in the Safari developer tools? – philnash Jul 27 '21 at 08:39
  • @philnash Updated the question as requested. – DrSmrtnik Jul 27 '21 at 09:11
  • @philnash Just tested this with an IPhone. The video element displays a *play* button, when I press the play button, dark screen. Is it possible that the video is blocked by autoplay? But I have a user interaction before joining the room, and the audio has no problem. Maybe the browser blocks the video(autoplay policy) if i join the room in the useEffect hook? Any idea? – DrSmrtnik Jul 27 '21 at 09:29
  • From the remote side(worker side) which emits the video, the tracks are acquired before connecting to the room, and are passed to the connect options when joining the room. From the consumer side ( which should receive the video ), the audio track is acquired and published after connecting to the room. Trying to give you as much info as possible, i know the code is messy and buggy, but i want to figure out why the video does not work on IOS Safari – DrSmrtnik Jul 27 '21 at 09:33
  • I'm really not sure what's going on. I've just had a play around on iOS with [a React/Twilio Video app that I made a while back](https://github.com/philnash/twilio-video-react-hooks) and I had no trouble viewing a remote video from iOS. Can you try running my app and see if you see the same issues? I'm also interested in how your `useTrack` and `usePublications` hooks work. – philnash Jul 28 '21 at 03:40
  • @philnash I just tested your application. It works, but when i change Video Codec to h264 in the room settings from the Twilio Console, i get the dark screen. So i assume the issue is something with the video codec. – DrSmrtnik Jul 28 '21 at 08:13
  • You should only need the h264 codec if you need to support Safari versions less than 12.1 ([see more here](https://www.twilio.com/docs/video/managing-codecs#using-safari-121-in-group-rooms)). Can you work with VP8 instead? – philnash Jul 28 '21 at 12:43
  • @philnash That is the reason why we were using h264 codec, but for some reason remote videos with that codec on iOS are displayed black. (tested with twilio-react-app and your app). We changed the codec to VP8, and it seems to be working on iOS. After some research, we saw that around 7% of iOS users have a version < 12.1. So we will be using VP8 until we figure out why h264 videos are rendered black. If you have any idea why that is, let us know. Thank you very much for reaching out and helping! – DrSmrtnik Jul 28 '21 at 14:21

0 Answers0