Wowza Community

How to switch camera while streaming?

I want to switch Front/Back camera while having a live stream. How can this be accomplished?

I’m not sure if this is for iOS or Android SDK so I will provide both:

1. Here is the SDK class for Android for initial view:

https://www.wowza.com/docs/how-to-use-the-camera-view-in-gocoder-sdk-for-android

2. You can see how to switch camera views here with the switchCamera method.

(See here on GitHub sample for switch camera)

3. For the UI:

mBtnSwitchCamera = (MultiStateButton) findViewById(R.id.ic_switch_camera);

https://github.com/WowzaMediaSystems/gocoder-sdk-samples-android/blob/master/gocoder-sdk-sample-app/src/main/java/com/wowza/gocoder/sdk/sampleapp/CameraActivity.java

And here is how you would change that in iOS SDK:

https://www.wowza.com/docs/how-to-use-the-camera-view-in-gocoder-sdk-for-ios

Please note that you will need to enable the switch camera method using “previewCamera”.

Here is the GitHub sample code for you. Please scroll through to see UI switch camera options as well in the code:

https://github.com/WowzaMediaSystems/gocoder-sdk-samples-ios/blob/master/SDKSampleApp.swift/VideoViewController.swift