Cordova-plugin-iosrtc: Video Not Appear in IPhone

Created on 10 Oct 2018  路  7Comments  路  Source: cordova-rtc/cordova-plugin-iosrtc

Hello Sir,

Videos For Local And Remote Stream Not Appear in Video Element on iPhone but the stream work correctly to another devices

I am showing video elements in a div with z-index

I try:
cordova.plugins.iosrtc.refreshVideos();
cordova.plugins.iosrtc.observeVideo(videoElem);

is there any solutions?

Best Regards

Most helpful comment

We had a similar problem (videos on iOS were just black but appeared for the other party in the browser). For us the solution was to Math.round() the following two lines:

https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/blob/master/js/MediaStreamRenderer.js#L284
https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/blob/master/js/MediaStreamRenderer.js#L285

i.e. change them to

            videoViewWidth: Math.round(videoViewWidth),
            videoViewHeight: Math.round(videoViewHeight),

The video was not shown if either of the values of videoViewWidth and videoViewHeight were floats and not ints.

All 7 comments

TPC.onaddstream happens before the remote description set. Try to queue the handler like here:
https://github.com/jitsi/jitsi-meet/blob/master/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js

Or just delay it.

I have the same problem with iOS 12.

why should queueing onaddstream help? Not even the local video is shown, and to show this onaddstream is not used.

I guess the problem is somehow connected with attaching the stream to the video tag.
Or do I miss something?

@alaanasreng did you solve this problem some how?

I have working IOS12 app. The steps to make it work is pretty complex.
Easiest way to do it, is something like this:

rtcpeerConnection.onaddstream = (stream) ={
      setTimeout( handleStream,  200)
}

Also. Depending on your signaling, check for remoteDescription presence before createOffer / answer .
Simple self delaying is hacky, but can be helpful.

//anywhere ...
function handleRemoteTrack(stream, track){
  if(!remoteDescription)
  {
     return setTimeout( handleRemoteTrack.bind(this, stream, track), 200)
  }
  doHandleNewTrack()
}

We had a similar problem (videos on iOS were just black but appeared for the other party in the browser). For us the solution was to Math.round() the following two lines:

https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/blob/master/js/MediaStreamRenderer.js#L284
https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc/blob/master/js/MediaStreamRenderer.js#L285

i.e. change them to

            videoViewWidth: Math.round(videoViewWidth),
            videoViewHeight: Math.round(videoViewHeight),

The video was not shown if either of the values of videoViewWidth and videoViewHeight were floats and not ints.

@cah-dunn Thank you!

Was this page helpful?
0 / 5 - 0 ratings