Open dnx-xy opened 2 years ago
Working in dev and not working in prod often speaks to a race condition. I noticed that in a few places you were making calls without actually ensuring the previous promises were resolved. I would consider adding some logging to ensure that events are actually occurring in the order you expect them to, and to be more consistent in your use of promises/await/async.
hi, @slycoder thanks for the comment. I actualy pass the token as params in _onConnectButtonPress.. On Debug mode it works flawlessly. I thinks it because race condition you mention. But i have clean up some codes with just passing / fetching API for token and roomName, & passing it into _onConnectButton press in Production still doesnt kicking the onRoomDidConnect.
Does it have something to do with the Reff or anything elsel, or maybe you could shed some light about why it doesn't connect on production
`const {consultation, token,fullname} = route.params const createRoom = () => { let chatRoom = { consultation_code: consultation, username: fullname, } fetch('https://cms.xxx.co.id/api/consultation/patient/room', { method: "POST", headers: { Authorization: 'Bearer ' + token, Accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify(chatRoom) }) .then(response => response.json()) .then(async responseJson => { console.log('roomIDN', responseJson.room.roomID) await getToken(responseJson.room.roomID) setRoomID(responseJson.room.roomID) }) }
const getToken = (roomer) => {
console.log('roomer', roomer, fullname)
fetch(`http://54.xxx.173.71:3403/token?identity=${fullname}=&room=${roomer}`)
.then(response => response.json())
.then(async responseJson => {
console.log('corstwilio', responseJson)
setAccessToken(responseJson.token)
await _onConnectButtonPress(responseJson.token,roomer)
})
}
const _onConnectButtonPress = async(tokenVids, roomer) => {
if(Platform.OS == 'android'){
await _requestAudioPermission();
await _requestCameraPermission();
}
twilioRef.current.connect({
accessToken: tokenVids,
roomName: roomer
})
setStatus('connecting');
clearTimer(getDeadTime());
};`
I'm trying to turn off/on hermes to see if it works without it
I have solved the problem. Apparently due to Android restriction cannot resolve from HTTP connection on release version
My token get from http connection. Thanks
I am having similar issue even if I am able to fetch the token
I have solved the problem. Apparently due to Android restriction cannot resolve from HTTP connection on release version
My token get from http connection. Thanks
would you mind sharing how did you actuall solve the issue?
Just enable http clear traffic true in Android.xml
Steps to reproduce
const CameraView = ({ route, navigation }) => { const { isType, namaDokter, fullname, subjektif, token, consultation } = route.params const [isAudioEnabled, setIsAudioEnabled] = useState(true); const [isVideoEnabled, setIsVideoEnabled] = useState(true); const [status, setStatus] = useState("disconnected"); const [participants, setParticipants] = useState(new Map()); const [videoTracks, setVideoTracks] = useState(new Map()); const [timer, setTimer] = useState('30:00'); const twilioRef = useRef(null); const Ref = useRef(null); const [accessToken, setAccessToken] = useState('') const [roomID, setRoomID] = useState('')
}; export default CameraView; `
Expected behaviour
twilioRef.current.connect should call _onDidConnect method
Actual behaviour
No Participant Video nor Client on Room | _onDidConnect doesnt called. No Video Remote Participantt (RELEASE)
But Works On Debug
_onDidConnect doesn't fire no video remote show
Environment
react-native-twilio-video-webrtc
Version: npm version or "master" Latest 2.10