iOS Popup Permission Stream Issue

Background

In intercom and recording scenarios, when requesting permissions for the first time, iOS will show a system permission popup.
At this time, the page triggers the onHide event, and the player component mistakenly assumes the page is in the background, stopping the stream.
After the user allows or denies the permission, the popup closes and the page triggers onShow, and the player resumes streaming.

Due to the temporary stream interruption, intercom or recording functions may fail, so additional handling is required.

Solution

Lite Player Component

Before triggering the iOS permission popup, set this property to true to prevent the player from stopping the stream due to the onHide event.
A new event onChangeIgnoreHideStopPreview is provided to listen for internal state changes and restore the original value.

💡 Note: Make sure @ray-js/ray-ipc-player is upgraded to the latest version.

Example:

import IpcPlayer from '@ray-js/ray-ipc-player';
import { useState } from 'react';

const [ignoreHideStopPreview, setIgnoreHideStopPreview] = useState(false);

const deviceId = '1234567890xxxxxx';
// Device online status
const onlineStatus = true;

// Listen for property changes and restore ignoreHideStopPreview
const onChangeIgnoreHideStopPreview = (value) => {
    setIgnoreHideStopPreview(value);
};

const onCtx = (ctx) => {
  console.log(ctx, 'ctx');
};

const authorizeTest = () => {
    // Set ignoreHideStopPreview to true before requesting permission
    setIgnoreHideStopPreview(true);
    // Call permission request API (implement as needed, see previous intercom/recording permission doc)
    ty.authorize({
        scope: 'xxx',
        success: () => {},
        fail: () => {}
    });
}

<IpcPlayer
    objectFit={'contain'}
    onCtx={onCtx}
    devId={deviceId}
    onChangeStreamStatus={onChangeStreamStatus}
    ignoreHideStopPreview
    onChangeIgnoreHideStopPreview={onChangeIgnoreHideStopPreview}
/>