iOS OpenTok audio-video call has video disabled with an undocumented reason on iOS Simulator and routed sessions - ios

While testing on the iOS Simulator a vide call with routed sessions the user gets its video disabled with an undocumented reason.
On the latest version of OpenTok 2.15.3 we can see that the possible reasons for video being disabled are:
typedef NS_ENUM(int32_t, OTSubscriberVideoEventReason) {
OTSubscriberVideoEventPublisherPropertyChanged = 1,
OTSubscriberVideoEventSubscriberPropertyChanged = 2,
OTSubscriberVideoEventQualityChanged = 3
};
on the iOS 11 simulator, right after trying to subscribe I'm getting the video enabled with OTSubscriberVideoEventReason == 2, right after it gets disabled with OTSubscriberVideoEventReason == 4 and then I get the following error on subscriberDidDisconnectFromStream:
Internal error -- WebRTC subscriber error.
Failed to set remote offer sdp:
Session error code: ERROR_CONTENT.
Session error description: Failed to set remote video description send
parameters..
kPCFailureSetRemoteDescription
The docs suggested trying to resubscribe, or reconnect... resubscribing didn't work. Furthermore it's only happening on the simulator, which makes me think that there is nothing really wrong with the setup, but the real question here is, what is the OTSubscriberVideoEventReason == 4?

TokBox Developer Evangelist here.
Yes, unfortunately, we didn't publicly document this specific case(sorry about that). We plan on adding this in the 2.16.0 release.
The reason that OTSubscriberVideoEventReason=4 is dispatched is when the video in the subscriber stream was disabled because the stream uses a video codec (such as H.264) that's not supported on the simulator.

Related

Why did AudioQueueAllocateBuffer fail?

Device: iPhone X
System: OS 15.1
I came across an error when using AudioQueue to play some data. The error is returned by this API and its value is -308.
OSStatus status = AudioQueueAllocateBuffer(_audioQueue, MIN_SIZE_PER_FRAME, &audioQueueBuffers[i]);
After that, All the AudioQueue APIs will return the error -66671. The official documents define as below.
kAudioQueueErr_QueueInvalidated
In iOS, the audio server has exited, causing the audio queue to become invalid.
However, I have no idea what the audio server means. Could any guy tell me what had happened?

ISO14443 - React Native NFC sometimes "Tag connection lost" - only on iOS

Context & Problem:
I’m writing a React Native application which has to communicate with NFC MiFare Ultralight tags. I have NXP NTAG I2C PLUS ISO14443-3 tags.
I’m using the react-native-nfc-manager library for this. On android I didn’t notice any problems just on the iOS side. I’m testing on iOS 13 and 14 and my device is an iPhone 7.
I am able to find and connect to NFC Mifare Ultralight tags (can read and write them too), but in the 75% of the situations I get the following error during the communications:
[CoreNFC] 00000002 803f43f0 -[NFCTagReaderSession transceive:tagUpdate:error:]:771 Error Domain=NFCError Code=100 "Tag connection lost" UserInfo={NSLocalizedDescription=Tag connection lost}
This problem only appears on iOS. Android works fine.
How I communicate:
I added the NDEF and TAG formats to the entitlements file to the …readersession.formats.
I also added value to the info.plist for the Privacy - NFC Scan Usage Description.
I’m requesting NfcTech.MifareIOS tech and calling the NfcManager.sendMifareCommandIOS() method as the library’s MiFare example shows. I’ve tried to use other transmitter methods and requesting other tech types, but in those situations I didn’t even get any responses.
This is how I create the writing commands and how I call my transmit method:
// WRITE COMMAND looks like: [0xA2, Addr, datas]
const writeCommand = [0xa2, offset, data[0], data[1], data[2], data[3]];
const response = await this.transmit(writeCommand);
This is how I create the reading commands:
// FAST_READ COMMAND looks like: [0x3A, StartAddr, EndAddr]
const readCommand = [0x3a, offset, offset + readLength];
And here is my transmit method:
private async transmit(msg: number[]): Promise<number[]> {
...
const cmd = Platform.OS === 'ios' ? NfcManager.sendMifareCommandIOS : NfcManager.transceive;
return await cmd(msg);
}
What I noticed and tried:
I noticed that the iPhone is very sensitive for the positioning. If I hold the device in a certain position I can also achieve 80% success. I noticed too that if I leave the phone on the tag I get this error more often. I got better results when I took away the phone after a communication and then put it back again.
When I added some sleep after the communication for example 100 ms, the communication seemed to be more stable. Because of the number of communications, I can't wait that much. Even if I wait I get the error, but fewer times.
I saw a very similar issue which describes a CRC problem, which appears when you try to send CRC, but that has been automatically added already by the iOS. I’m not sending the CRC (which was the solution in the mentioned issue), so that shouldn't be a problem.
Also saw the following issue with similar problem, but I have another type of tags - ISO-14443 and I'm also able to connect and communicate with the tags which wasn't the case in the mentioned issue.
Tried to invalidate the session after each communication, but didn’t help to stabilize the connection.
Tried with multiple tags (but with the same tag type), but got the same results.
I'd appreciate very much any ideas that could help me solve this problem.
At the end I managed to try out our app on multiple iPhones and the NFC worked properly.
We also found out that our test device is a refurbished unit and we think that maybe that is the problem's cause.

Chromecast Disconnects After Several Minutes

I'm developing an iOS app and have it Casting video to my Chromecast. I'm using the latest Cast SDK, the Default Receiver app, the stock Cast Button and Device Selection Dialog, etc.
I can successfully cast an HLS VOD playlist to the Chromecast and it plays fine. When I try to cast an HLS Livestream playlist, I get a disconnect after 3-5 minutes of play.
What happens is that my GCKSessionManagerListener receives the call sessionManager(_ sessionManager: GCKSessionManager, didSuspend session: GCKSession, with reason: GCKConnectionSuspendReason) with a suspend reason of -1 which...is not even in the enum?
I also get this in the log in Xcode, although I can't tell if it's an effect or a precipitation:
2018-04-10 09:43:58.414377-0700 iOS[4968:4491455] [] <<<< AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>> -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device discovery mode to DiscoveryMode_None (client: iOS)
This is not caused by my iPhone app going to background, as most "disconnection problems" seem to be; in fact, it can go to background just fine because I configured the context options with suspendSessionsWhenBackgrounded = false. It just dies after about 4 minutes.
If I switch to a stock Receiver app and debug it via chrome://inspect, I saw only one error near the start of playing (something about an Item ID not supposed to be set) and then about 4 minutes later I get Debugging connection closed. Reason: Connection was lost.
How can I debug this or get more information about why my session is disconnecting?
Something is mismatching in the media stream you are using and the required specifications for your stream.
Try playing some sample videos (which works properly with casting examples) with your device and see if you are facing the same problem.
If you are able to play some videos properly with same code then try making changes in your stream as per the specification provided by chromecast.
https://developers.google.com/cast/docs/media

com.google.GCKError Code=2 when connecting to ChromeCast device

I'm working on an iOS app where I now want to integrate ChromeCast support. I use the HelloGoogleVideoCast example to test my hardware setup and get inspiration for my app.
I have now stumbled on a problem that is present both in my app and in HelloGoogleVideoCast. When I connect to a device (connectToDevice method in HelloGoogleVideoCast) I get error "The operation couldn’t be completed. (com.google.GCKError error 2.)". I have power-cycled the device with no change in behavior. I never get to the callback deviceManagerDidConnect, instead deviceManager:didFailToConnectWithError is called with this error. Still, I can connect with the iOS YouTube app.
I can't find anything with substance if I google it and I can't find any good ChromeCast developer forums.
Is there anybody who has an inroad to how to solve this?
I m not sure it will help but u can try:
Download the Chromecast app from app store:
chromecast link
After u see your chromecast -> select your chromecast -> General -> make sure both check box are selected (I know the text is nothing to do with your problem).
Try now.
If the error still occur, try to reboot your chromecast.
If your error still occur, try to reset your chromecast, and then check the boxes again (don't forget!).
Make sure that you initialize the Receiver Manager in your receiver app as soon as possible. Don't wait for the window.onload. If the receiver takes too long to load and initialize the receiver manager, the connection is automatically torn down.
I had the same problem as you did and making the following changes on receiver worked for me:
I've put the script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js" inside head tag and before title tag;
I've put my script file which managed all cast functions after
body tag (actually I've put all script declarations, except for cast_receiver, after body tag, including jQuery);
I hope it can help you yet :)

how to get audio session initialization error status since AudioSessionInitialize was deprecated?

On start app i called AudioSessionInitialize and check result value.
If it was kAudioSessionInitializationError then i informed user that application can not work properly cause audio does not work.
But since iOS 7 this function was deprecated.
It was similar question before: A fix for AudioSessionInitialize Deprecated? but... it has no any mention about how to get initialization error status.
And of course, i know how to initialize audio session without this function: Just calling [AVAudioSession sharedInstance] cause hidden call of AudioSessionInitialize. But it returns non zero value anyway. So new interface does not allow to get initialization error status.
upd: I'm not sure it's important but i receive message to stdout (which i redirected to log file) while call with error happens:
ERROR: [7971] 146: Unable to talk to server: error 0x10000003
(268435459)
explaination why i need this:
It happens very rarely (less then 0,1% of case) but it happens for any firmware. Last case registered for iOS 7.0.3 - so it's actual return value still (btw, first case registered for first firmware my app supported: iOS 2.2). It's important feature (cause i develop alarm clock) - it allows to know user about issues in the evening and not in the morning (cause in the morning this issue will cause oversleep).

Resources