TrustNXTTrustNXT
React SDKAPI ReferenceFunctions

getFirefoxAndroidStreamStyle()

function getFirefoxAndroidStreamStyle(orientation): Record<string, string> | null;

CSS style object to fix Firefox Android video stream rotation.

Firefox on Android has a known bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1802849) where the camera MediaStream video element doesn't rotate with device orientation. Apply the returned style to your <video> element to compensate.

Parameters

ParameterTypeDescription
orientationnumberDevice orientation angle (0, 90, 180, 270)

Returns

Record<string, string> | null

CSS properties to apply, or null if no fix is needed

Example

const style = getFirefoxAndroidStreamStyle(orientation);
return <video ref={previewRef} style={style ?? { width: "100%", height: "100%" }} />;

On this page