before starting live broadcast i have to enable users camera which users can see how his face looks like etc..but unfortunatly this screen become blank in my device. live screen is working perfectly. could anyone help me with this? iam using react native version 0.71.14. and agora version "react-native-agora": "^4.2.6",
`import React, {useRef, useState, useEffect} from 'react';
import {
SafeAreaView,
ScrollView,
StyleSheet,
Text,
View,
TouchableOpacity,
Image,
} from 'react-native';
import {PermissionsAndroid, Platform} from 'react-native';
import {
createAgoraRtcEngine,
RtcSurfaceView,
ChannelProfileType,
ClientRoleType,
} from 'react-native-agora';
import {
heightPercentageToDP as hp,
widthPercentageToDP as wp,
} from 'react-native-responsive-screen';
import SVGImage from '../../../components/SVGImages';
import {PATH, SCREENS} from '../../../shared/constants';
import fonts from '../../../shared/theme/fonts';
import {palette} from '../../../shared/theme/themes';
import * as NavigationService from '../../../navigation/NavigationService';
import AppModalWithDuelButton from '../../../components/AppModalWithDuelButton';
import {generatePublisherLiveStreamToken} from '../../../services/api/apiCall';
import {useSelector} from 'react-redux';
before starting live broadcast i have to enable users camera which users can see how his face looks like etc..but unfortunatly this screen become blank in my device. live screen is working perfectly. could anyone help me with this? iam using react native version 0.71.14. and agora version "react-native-agora": "^4.2.6",
`import React, {useRef, useState, useEffect} from 'react'; import { SafeAreaView, ScrollView, StyleSheet, Text, View, TouchableOpacity, Image, } from 'react-native'; import {PermissionsAndroid, Platform} from 'react-native'; import { createAgoraRtcEngine, RtcSurfaceView, ChannelProfileType, ClientRoleType, } from 'react-native-agora'; import { heightPercentageToDP as hp, widthPercentageToDP as wp, } from 'react-native-responsive-screen'; import SVGImage from '../../../components/SVGImages'; import {PATH, SCREENS} from '../../../shared/constants'; import fonts from '../../../shared/theme/fonts'; import {palette} from '../../../shared/theme/themes'; import * as NavigationService from '../../../navigation/NavigationService'; import AppModalWithDuelButton from '../../../components/AppModalWithDuelButton'; import {generatePublisherLiveStreamToken} from '../../../services/api/apiCall'; import {useSelector} from 'react-redux';
const LiveLandingScreen = () => { const agoraEngineRef = useRef(null); const [isModalVisible, setIsModalVisible] = useState(false);
const userId = useSelector( state => state?.auth?.userProfile?.user_info?.superstar_id, );
const usersDp = [ require('../../../../assets/images/user3.png'), require('../../../../assets/images/user2.png'), require('../../../../assets/images/user1.png'), ];
useEffect(() => { setupVideoSDKEngine(); return () => (agoraEngineRef.current = null); }, []);
const setupVideoSDKEngine = async () => { try { if (Platform.OS === 'android') { const granted = await getPermission(); if (!granted) { console.log('Permissions not granted'); return; } } agoraEngineRef.current = createAgoraRtcEngine(); const agoraEngine = agoraEngineRef.current;
};
const getPermission = async () => { if (Platform.OS === 'android') { const permissions = await PermissionsAndroid.requestMultiple([ PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, PermissionsAndroid.PERMISSIONS.CAMERA, ]); return ( permissions[PermissionsAndroid.PERMISSIONS.CAMERA] === 'granted' && permissions[PermissionsAndroid.PERMISSIONS.RECORD_AUDIO] === 'granted' ); } return true; };
const join = async () => { try { const uniqueChannelName = 'channel-' + Date.now(); const response = await generatePublisherLiveStreamToken({ channelName: uniqueChannelName, });
};
return (
); };`