Wowza Community

Problem with device orientation

Hi

I have a problem with device orientation using gocoder.

On the same devide with same gocoder version 1.9.1 an app that use gocoder in an activity works well but a second app seems to not recognize correct device orientation (the app uses gocoder in a fragment and I forced landscape but seems that gocoder record in portrait)

A link to see videos: https://drive.google.com/open?id=1KecAVxXzvV7sZpG5rXydEvz4gdRRlomo

Are you using a fragment on both apps or is the issue only when you call the PlayerView in a fragment in the 2nd app @DarthXander?

Hi @DarthXander,

can you please make a sample app with 2 activities. In the first activity you play (or broadcast or record) the video and in the second you do the same but within a fragment.

Then please share this code with me so I can reproduce the issue.

Thanks

The issue is only for the app using the fragment

Thanks for your support but I can’t share the code because I have no permission to do it.

If possible I would know if there are some methods in GoCoder SDK to know the gocoder orientation and to force programmatically the landscape.

I partially resolved using the same approach of the first app. I open gocoder on another activity. In the next days I’ll try to test the solution using fragment.

Hello @DarthXander

This is how you can detect the device orientation:
https://www.wowza.com/resources/gocodersdk/docs/api-reference-android/com/wowza/gocoder/sdk/api/devices/WOWZDeviceUtils.html

Likely you’ll need to stop and restart the stream with the new orientation:

https://www.wowza.com/docs/how-to-live-stream-with-wowza-gocoder-sdk-for-android

Then set to landscape:

https://www.wowza.com/resources/gocodersdk/docs/api-reference-android/com/wowza/gocoder/sdk/api/configuration/WOWZMediaConfig.html#ORIENTATION_LANDSCAPE

Regards,

JasonT

I worked again on this point but I did not found a solution yet.

If I use GoCoder in an Activity (opened by main activity) or if I use GoCoder in a Fragment opened by main activity SDK config seems to be ok.

Theese are the logs:

mWZBroadcastConfig.getVideoSourceConfig().getVideoFrameHeight(): 480 mWZBroadcastConfig.getVideoSourceConfig().getVideoFrameWidth(): 640 mWZBroadcastConfig.getVideoFrameHeight(): 720 mWZBroadcastConfig.getVideoFrameWidth(): 1280 mWZBroadcastConfig.getVideoFrameSize().height: 720 mWZBroadcastConfig.getVideoFrameSize().width: 1280

mWZBroadcastConfig.getOrientationBehavior() = ORIENTATION_LANDSCAPE_INVERTED in both cases

mWZBroadcastConfig.getRotation = 0 in both cases

But I seen some other logs during the stream that show the strange behavior.

Activity

I/ExtendedACodec: [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = ‘conf’, target = 1) = { int32_t capture-rate = 30 int32_t color-format = 2130708361 int32_t i-frame-interval = 1 string mime = “video/avc” int32_t width = 1280 int32_t bitrate = 3750000 int32_t frame-rate = 30 int32_t height = 720 int32_t encoder = 1 }

D/WMSTransport: [00]: “@setDataFrame”, [01]: “onMetaData”, [02]: {“videocodecid”: “avc1”, “width”: 1280, “height”: 720, “frameWidth”: 1280, “frameHeight”: 720, “displayWidth”: 1280, “displayHeight”: 720, “framerate”: 30, “videodatarate”: 3662, “audiocodecid”: “mp4a”, “audiosamplerate”: 44100, “audiochannels”: 2, “audiodatarate”: 62, “aacaot”: 2}

Fragment

I/ExtendedACodec: [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = ‘conf’, target = 1) = { int32_t capture-rate = 30 int32_t color-format = 2130708361 int32_t i-frame-interval = 1 string mime = “video/avc” int32_t width = 720 int32_t bitrate = 3750000 int32_t frame-rate = 30 int32_t height = 1280 int32_t encoder = 1 }

D/WMSTransport: [00]: “@setDataFrame”, [01]: “onMetaData”, [02]: {“videocodecid”: “avc1”, “width”: 720, “height”: 1280, “frameWidth”: 720, “frameHeight”: 1280, “displayWidth”: 720, “displayHeight”: 1280, “framerate”: 30, “videodatarate”: 3662, “audiocodecid”: “mp4a”, “audiosamplerate”: 44100, “audiochannels”: 2, “audiodatarate”: 62, “aacaot”: 2}

In the fragment’s logs width and height are inverted :frowning:

MainActivity and GoCoder Activity extend both AppCompatActivity

This is how I manage the orientation in the fragment

@Overridepublic void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated( savedInstanceState );
    getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE );
    ((AppCompatActivity) getActivity()).getSupportActionBar().hide();

}

SDK configs seems to be ok, also device orientation detected by SDK methods.

But using fragment the problem persist.

See my last response to main thread

Having someone look into it for you and we are aware that the fragment is not well supported in some devices.