RTCEAGLVideoView orientation change freezes the stream - ios

I inherited an iOS webRTC app from someone else and now i am stuck with a problem for a code i am not familiar with.
It's a pretty generic webRTC video stream inside a Cordova iOS app. The problem im trying to solve is, that the video stream freezes, upon device orientation change. So when I change from lansdscape to portrait, the stream freezes. The app is landscape only, so therefore I would prefer that the video stream never changes orientation in the first place. Question is, how can I prevent a webRTC Videostream to switch orientations.
The app uses the RTCEAGLVideoView class to display the video stream. If anyone has any ideas for me where to even start to prevent that view from switching and therefor freezing, you would save my day.

I would suggest to use RTCCameraPreviewView for your local stream and RTCMTLVideoView for your remote stream.
As you read this post it has fixes for the same:
https://bugs.chromium.org/p/webrtc/issues/detail?id=7442
Also update your GoogleWebRTC SDK in case you are using older version.

Related

multiple webRTC replaceTrack() calls for swapping two video streams

I'm making a video call application with two video sources: camera / screen record,
and let the users switch camera <-> screen record multiple times during a call.
RTCRtpSender.replaceTrack() allows me to replace the camera stream with the screen record stream.
But if I try to switch back to the camera stream, it doesn't work on ios.
On android, I found this document. It seems that replaceTrack() will auto-dispose the track when it's no longer needed. If I use setTrack(_, takeOwnership=false), and it works ok.
I wonder if I can do the same on ios.
I'm developing a flutter application & using this library, but I wonder if this is even possible on ios native.

WebRTC audio is not working in lock screen using CallKit

I have tried many solutions from here but no one is working. WebRTC is working fine and I get connected status when accepting the call while the device is locked and after the unlock the audio opens and video starts. How could I get only audio when the screen remains locked?
I have enabled RTCAudioSession and disabled it when the call stops.
It's working fine when the device is unlocked the first time and when I lock it back I'm getting the audio. But the first time, when I answer the call from CallKit, it is not working. It only starts working after the device is unlocked.
I don't know the cause of your specific problem, but what I learnt from similar issue while integrating CallKit with WebRTC, you must acquire camera and microphone access only inside the DidActivateAudioSession method of your implementation of the CXProviderDelegate class. Otherwise, you will get weird issues.

Rox Video Xamarin Forms Ios Not working

I am using Rox video plugin to play videos in Xamarin forms iOS. It plays the video perfectly however if I change device orientation or change to a different screen the video continues to play in the background. I can hear the audio continuing. When returning to the video player view I it loads a new version of the video up.
Can anyone with experience in the Rox Video plugin assist? or offer a free alternative to this plugin?
I searched the issue list of RoxXamarinVideo on github but found nothing about your problem.
I suggest you use FormsNativeVideoPlayer, it seems to have a great support on orientation changes.

Cordova - 'AVAudioSessionDelegateMediaPlayerOnly end interruption' error after pausing and resuming an app

This issue has arose using Cordova to play videos within an iOS application. I had thought to use the pause/resume feature to interact with the HTML5 video. However even when the video has stopped playing and the element has been set to display:none, or faded out etc, this error still appears in the console after the app is resumed - which then renders all video playing useless after it.
MP AVAudioSessionDelegateMediaPlayerOnly end interruption. Interruptor
<________-1874> category <(null)> resumable <0>, _state = 1
I have found issues relating to this, but are answered using C Objective for native app building.. and because I am using Cordova to build they do not apply unfortunately.
Has anyone else playing videos within PhoneGap/Cordova/Chrome Apps come across this and can offer a solution? Or anyone coding Native iOS apps could offer some advice as to why it is happening?
So to fix this (for anyone who may come across this in the future!), i had to resort to a bit of a hacky method.
When the Cordova iOS app is pushed to the background, and resumed, it looks as though any running video tags were unable to continue load and play video - the error above pops up in Xcode console and the video element is black no matter what. (I was fading still images on top of a video tag, then loading a new video using data attributes after a hotspot on the image is pressed). So when the app is paused I had to use JS/jQuery to remove and on resume it re-creates the video element and used the last selected data attributes to pick up the info from where it left off..
Seems to work, and is surprisngly seamless! :)

NetStream http Video not playing on IOS device

I am trying to play a video on iPad, my code is below :
public function init_RTMP():void
{
videoURL = "http://rest************_iphone_high.mp4";
vid = new Video();
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus);
nc.connect(null);
}
private function onConnectionStatus(e:NetStatusEvent):void
{
if (e.info.code == "NetConnection.Connect.Success")
{
trace("Creating NetStream");
netStreamObj = new NetStream(nc);
metaListener = new Object();
metaListener.onMetaData = received_Meta;
netStreamObj.client = metaListener;
netStreamObj.play(videoURL);
vid.attachNetStream(netStreamObj);
addChild(vid);
}
}
when i play it on my system it is working fine, but when i create a IOS app of it and installs on device, it shows white blank screen.
If anyone have same problem or any idea please share with me.
As VC.One pointed out, AIR for iOS does not play most (but not all, it will occasionally play a very specific encode type) h.264 encoded videos. There are three solutions:
As VC.One said, you encode as FLV. Doing this is not good and I would not recommend it. FLV is not hardware accelerated (unless things have changed recently and I have not seen the updates) and will run entirely off the CPU meaning your app will run slowly and the app will eat battery much quicker than normal.
Use StageWebView, in which case you just plug in the URL to the video and it will play the video using the native video player. This has the down side in that you cannot skint he player and you cannot control it. Once it begins playing, you have no control over it except for unloading the page. This works very well, however, and is fairly easy to implement, though the video will appear on top of the stage (it is not in the Display List).
The last option is to use StageVideo. This will play videos using the native framework, so you can easily play h.264 and it will be hardware accelerated. Additionally, this is just a NetStream player so you have full control over it. And best yet, it has no chrome so you can build a player around the video screen. However, like StageWebView, StageVideo is not in the Display List. But unlike StageWebView, it is rendered directly on the stage, below everything else. So the app itself will cover the video. You can get around this by creating a class to mask your app around the video, but it is incredibly difficult to properly pull off. It took me about 12 hours to create my StageVideo player and the masking class, plus another half day later on fixing issues with the masking class and how it handles DPI changes (hint: do NOT set applicationDPI if you are using Flex)
As always, make sure your AIR SDK is up to date as well. 3.5-3.7 have all added a ton of new features and bug fixes for iOS applications so updating to AIR 3.7 might actually solve or make your issue less of a problem (I don't think it will, but it is always worth a shot, right?)
See this link:
Netstream video not playing on iPad
Basically it was fixed by encoding the video file as FLV not MP4.

Resources