api.video-reactnative-live-stream: [Bug]: Android camera 'back' is used when camera prop is 'front'

Version

v2.0.0

Which operating systems have you used?

  • Android
  • iOS

Environment that reproduces the issue

Google Pixel 7

Is it reproducible in the example application?

Not tested

RTMP Server

NA, happens before streaming

Reproduction steps

  1. pass prop camera={‘front’}
<ApiVideoLiveStreamView
         key={'ApiVideoLiveStreamView'}
         style={styles.liveStreamView}
         ref={ref}
         camera={'front'}
         enablePinchedZoom={true}
         video={{
           fps: 30,
           resolution: { width: 1080, height: 1920 },
           bitrate: 2 * 1024 * 1024, // # 2 Mbps
           gopDuration: 1 // 1 second
         }}
         audio={{
           bitrate: 128000,
           sampleRate: 44100,
           isStereo: true
         }}
         isMuted={false}
         onConnectionSuccess={onConnectionSuccess}
         onConnectionFailed={onConnectionFailed}
         onDisconnect={onDisconnect}
       />

Expected result

‘front’ camera is used

Actual result

‘back’ camera is used.

Additional context

The bug report form did not have that version v2.0.0. !!! Works correctly on iOS.

Workaround:

  1. Set camera prop to undefined initially.
  2. Within a setTimeout (500ms - 1sec) trigger state changes to set the camera prop to ‘front’.

Relevant logs output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

@giantslogik another way of dealing with this is to catch the exception when calling startPreview. I could create a branch with this fix. Could you test it?

I’ll try and modify the example in the repo. May take me a while to get to it.

Hi, Could you test on main branch?

Hi,

It is a random issue. I made changes in the Android dependency. It will be fixed in 2.0.1.