Set screen orientation in an application

The Azure Communication Services UI Library enables developers to set the orientation of screens in an application. You can specify screen orientation mode on the call setup screen and on the call screen of the UI Library.

Prerequisites

Set the screen orientation

For more information, see the open-source Android UI Library and the sample application code.

Available orientations

The following table lists CallCompositeSupportedScreenOrientation types for out-of-the-box orientations. If you want to set the orientation of the various screens of the composite, set CallCompositeSupportedScreenOrientation to CallComposite.

Orientation mode CallCompositeSupportedScreenOrientation type
PORTRAIT CallCompositeSupportedScreenOrientation.PORTRAIT
LANDSCAPE CallCompositeSupportedScreenOrientation.LANDSCAPE
REVERSE_LANDSCAPE CallCompositeSupportedScreenOrientation.REVERSE_LANDSCAPE
USER_LANDSCAPE CallCompositeSupportedScreenOrientation.USER_LANDSCAPE
FULL_SENSOR CallCompositeSupportedScreenOrientation.FULL_SENSOR
USER CallCompositeSupportedScreenOrientation.USER

Orientation API

CallCompositeSupportedScreenOrientation is a custom type for the Android UI Library. The name for the orientation type is defined by keeping similarity with the names of the Android platform's orientation modes.

By default, the setup screen orientation is in PORTRAIT mode and the calling screen is in USER mode. To set a different orientation for the screens, you can pass CallCompositeSupportedScreenOrientation. Out of the box, the UI Library includes a set of CallCompositeSupportedScreenOrientation types that are usable with the composite.

You can also get a list of CallCompositeSupportedScreenOrientation types by using the static function CallCompositeSupportedScreenOrientation.values().

To set the orientation, specify CallCompositeSupportedScreenOrientation and pass it to CallCompositeBuilder. The following example sets FULL_SENSOR for the setup screen and LANDSCAPE for the calling screen of the composite.

import com.azure.android.communication.ui.calling.models.CallCompositeSupportedScreenOrientation

// CallCompositeSupportedLocale provides a list of supported locales
val callComposite: CallComposite =
            CallCompositeBuilder()
            .setupScreenOrientation(CallCompositeSupportedScreenOrientation.FULL_SENSOR)
            .callScreenOrientation(CallCompositeSupportedScreenOrientation.LANDSCAPE)
            .build()

For more information, see the open-source iOS UI Library and the sample application code.

Available orientations

The following table lists OrientationOptions types for out-of-the-box orientations. If you want to set the orientation of the various screens of the composite, set OrientationOptions to CallComposite.

Orientation mode OrientationOptions type
portrait OrientationOptions.portrait
landscape OrientationOptions.landscape
landscapeRight OrientationOptions.landscapeRight
landscapeLeft OrientationOptions.landscapeLeft
allButUpsideDown OrientationOptions.allButUpsideDown

Orientation API

OrientationOptions is a custom type for the iOS UI Library. The name for the orientation type is defined by keeping similarity with the names of the iOS platform's orientation modes.

By default, the setup screen orientation is in portrait mode and the calling screen is in allButUpsideDown mode. To set a different orientation for the screens, you can pass OrientationOptions. Out of the box, the UI Library includes a set of OrientationOptions types that are usable with the composite.


let callCompositeOptions = CallCompositeOptions(localization: localizationConfig,
                                                setupScreenOrientation: OrientationOptions.portrait,
                                                callingScreenOrientation: OrientationOptions.allButUpsideDown)
let callComposite = CallComposite(withOptions: callCompositeOptions)

Next steps