Skip to content

Camera flashing and 'freezes' on iPhone X #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chrisedington opened this issue Nov 17, 2022 · 24 comments
Open

Camera flashing and 'freezes' on iPhone X #12

chrisedington opened this issue Nov 17, 2022 · 24 comments

Comments

@chrisedington
Copy link

Hi @AndrewShapovalov

Me again 😅 I found an issue where on two sets of iPhone X and using the sample, the camera flashes green colors and freezes.

Upload.from.GitHub.for.iOS.MOV

image

@AndrewShapovalov
Copy link
Contributor

Hi @chrisedington!

Thanks for the info. Do you have any chance to provide logs?

@chrisedington
Copy link
Author

@AndrewShapovalov can try - what source or kind of logs would you be looking for?

@AndrewShapovalov
Copy link
Contributor

@AndrewShapovalov can try - what source or kind of logs would you be looking for?

Debug logs from Xcode (Debug area) while the problem happens.

@AndrewShapovalov
Copy link
Contributor

Hi @chrisedington!

Some update from my side - tried to reproduce the bug on iPhone X with iOS version 16.1 but without luck.

@wizfinder
Copy link

I have same problem. I write Test Environment and Error log below.

Test Env.
Device:
iPhone 11, iOS 15.6.1

Video Resolution: 720x1280

Bug Reproduce

when preview screen's size is matched on iphone screen. It happened image capture action is too slow or flashing.

Debug Log:

2023-01-04 17:08:15.173949+0900 ivsTest[3973:200261] Execution of the command buffer was aborted due to an error during execution. Ignored (for causing prior/excessive GPU errors) (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)

...... above message is repeated

@AndrewShapovalov
Copy link
Contributor

Hi @wizfinder, thanks for the report!

Is the same or any other error in the onBroadcastError event handler?

@AndrewShapovalov
Copy link
Contributor

Hi @chrisedington @wizfinder! Me again.

It appears to be an internal issue, but since I am unable to reproduce it, could you please check the repository containing sample native apps that use the Amazon IVS Broadcast iOS SDK and see if you can reproduce the problem by running BasicBroadcast sample app?

@wizfinder
Copy link

Hi @chrisedington @wizfinder! Me again.

It appears to be an internal issue, but since I am unable to reproduce it, could you please check the repository containing sample native apps that use the Amazon IVS Broadcast iOS SDK and see if you can reproduce the problem by running BasicBroadcast sample app?

When I build BasicBroadcast and run, I don't have errors. Only I have errors in ReactNative env with iPhone 11.
and
In iPad Mini(6 Gen.), I don't have errors in ReactNative env.

@AndrewShapovalov
Copy link
Contributor

@wizfinder hi! Thanks for the update!

Do you face the same type of error by running Amazon IVS React Native Broadcast Example App?

Could you also provide detailed props configuration you pass to IVSBroadcastCameraView component (e.g. videoConfig, audioConfig, configurationPreset and others) please?

@wizfinder
Copy link

wizfinder commented Jan 16, 2023

I don't face the same error with Aws IVS ReactNative Broadcast Example App.

I wrote test code below. if width and height value are less than about 300, it works well.

const videoConfig = {
   width:720,
   height:1280,
   bitrate: 7500000,
   targetFrameRate: 30,
   keyframeInterval: 2,
   isBFrames: true,
   isAutoBitrate: true,
   maxBitrate: 8500000,
   minBitrate: 1500000
 }

......

<SafeAreaView>
 <IVSBroadcastCameraView style={{width:"100%", height:"100%"}}  
 //<IVSBroadcastCameraView width={300} height={300}
       ref={cameraViewRef}
       videoConfig={videoConfig}
       onIsBroadcastReady={onIsBroadcastReadyHandler}
       onBroadcastAudioStats={onBroadcastAudioStatsHandler}
       onBroadcastError={(e) => console.log("onBroadcastError", e)}
       onBroadcastStateChanged={(stateStatus, metadata) => console.log("onBroadcastStateChanged", stateStatus, metadata)}
       cameraPreviewAspectMode={"fit"}
 />
</SafeAreaView>

@codal-mpawar
Copy link

@wizfinder @chrisedington I am facing the same issue too.

@AndrewShapovalov
Copy link
Contributor

AndrewShapovalov commented Jan 17, 2023

I don't face the same error with Aws IVS ReactNative Broadcast Example App.

According to the answer you've provided, it appears that the issue might be within the project's codebase rather than with the package. Try experimenting with your component that utilizes the IVSBroadcastCameraView and configuration to identify possible issues.

I will also play around with the sample app using iPhone 11 to catch any related problems. @wizfinder

@rennard
Copy link

rennard commented Apr 15, 2023

Also having this issue, I've not yet been able to find any form of workaround

@cowlabs-xyz
Copy link

Hi,

We had the same issue and found that setting the width and height of broadcast to 320 worked for iPhone6 and around 400->500 on iphonex. If not the component will flash or hang.

Have not looked into the underlying native code to understand what is causing it yet.

Kim

@kimdanielarthur-cowlabs
Copy link

kimdanielarthur-cowlabs commented Aug 3, 2023

I have been testing a variety of configuration changes and it seems somehow related to the total number of pixels being rendered? I have been unable to find any workaround for the affected devices other than reducing streaming quality, so on iphone6/7 its 320p which would be great to increase :)

Anyone had any luck figuring it out?

@dongchan0321
Copy link

Hi, @AndrewShapovalov
I'm encountering the same issue with the Amazon IVS React Native Broadcast Example App. I've reproduced the problem on an iPhone XS (iOS 16.0.3) and an iPad Mini 5 (iPadOS 16.6). Following the IVS Broadcast SDK guidelines, I made some code modifications and the issue no longer occurs; everything runs smoothly.

// ios/IVSBroadcastCameraView/IVSBroadcastSessionService.swift

private func getCameraPreview() -> IVSImagePreviewView? {
  // let preview = try? self.broadcastSession?.previewView(with: self.cameraPreviewAspectMode)
  // preview?.setMirrored(self.isCameraPreviewMirrored)
  // return preview
  let preview = try? self.broadcastSession?.listAttachedDevices().compactMap({ $0 as? IVSImageDevice }).first?.previewView(with: self.cameraPreviewAspectMode)
  preview?.setMirrored(self.isCameraPreviewMirrored)
  return preview
}

Could you please review the changes to see if there might be any potential drawbacks?

@kimdanielarthur-cowlabs
Copy link

Thanks @dongchan0321 for this potential fix, did you have any experience with your change and if it all works ok with this implementation?

@dongchan0321
Copy link

I have tested the prolonged video streaming push on the same device where the issue was originally reproduced, and I haven't encountered any new problems so far. I plan to conduct further testing using devices of different models.
I am not a professional iOS developer, and this code segment originates from the IVS Broadcast SDK. After consulting the documentation, I was unable to identify the root cause of the issue.

Thanks @dongchan0321 for this potential fix, did you have any experience with your change and if it all works ok with this implementation?

@kimdanielarthur-cowlabs
Copy link

Thank you for replying! Yes I have tested on the devices we had issues with before and it seems to work perfectly. Now, we will also do some more testing across devices to validate before pushing it into production.

Very happy you found this, as its been a bit of a hindrance for us. Even on devices like iphone 11 pro we had to reduce resolution of streaming in order to work around the issue.

@AndrewShapovalov
Copy link
Contributor

Hello everyone,

Thank you all for your valuable input and code suggestions. I've taken your feedback into consideration and made changes to the same getCameraPreview method. Instead of using the first attached device in the list, I now use the attachedCameraUrn variable, which I believe is a more robust solution.

You can now try out these changes via NPM using the next dist-tag.

yarn add amazon-ivs-react-native-broadcast@next

Please, give it a try and provide feedback on your experiences.

@dongchan0321
Copy link

Hello everyone,

Thank you all for your valuable input and code suggestions. I've taken your feedback into consideration and made changes to the same getCameraPreview method. Instead of using the first attached device in the list, I now use the attachedCameraUrn variable, which I believe is a more robust solution.

You can now try out these changes via NPM using the next dist-tag.

yarn add amazon-ivs-react-native-broadcast@next

Please, give it a try and provide feedback on your experiences.

Hello, thank you for your fix. After conducting a brief real-device test, we have found that the devices that previously had issues are now functioning correctly. We have limited time for further testing at the moment, but we plan to perform additional validation with more devices in the future.

@kimdanielarthur-cowlabs
Copy link

As an fyi:
With the new code from next it seems the ios simulators are unable to get the camera preview. Whereas it works ok on devices. I am unsure if this is some behaviour locally on my side or not, using latest xcode.

dan-herasymov referenced this issue in dan-herasymov/amazon-ivs-react-native-broadcast Oct 19, 2023
fix: camera flashing and freezing #12
dan-herasymov referenced this issue in dan-herasymov/amazon-ivs-react-native-broadcast Oct 19, 2023
@wulaizi
Copy link

wulaizi commented Oct 30, 2023

I used amazon-ivs-react-native-broadcast, and after running pod install, the project crashed immediately. My Xcode version is 14.3, and I'm using the iOS 14 Pro simulator with macOS version 16.4.
Snipaste_2023-10-30_11-28-56

@wulaizi
Copy link

wulaizi commented Oct 30, 2023

I used amazon-ivs-react-native-broadcast, and after running pod install, the project crashed immediately. My Xcode version is 14.3, and I'm using the iOS 14 Pro simulator with macOS version 16.4. Snipaste_2023-10-30_11-28-56
I encountered the same issue with the demo project provided by the amazon-ivs-react-native-broadcast library. I also created an empty project, added amazon-ivs-react-native-broadcast as a dependency, and faced the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants