ReactVision / viro

ViroReact: The AR and VR library for React Native šŸ“³šŸ’™šŸ’›šŸ¤šŸ’š
MIT License
1.3k stars 150 forks source link

ViroSound nos stopping on iOS #187

Open leandro2219 opened 1 year ago

leandro2219 commented 1 year ago

Requirements:

Please provide the following information about your environment:

  1. Development OS: Windows,
  2. Device OS & Version: iOS 13.7
  3. Version: "@viro-community/react-viro": "^2.20.2", "react": "17.0.2", "react-native": "0.65.1"
  4. Device(s): Iphone 7 y Iphone 11

Description Hi, We are creating an App which people can use it on our magazine, pointing to some areas and hearing some sound, viewing videos and viewing 3dObject. My problem is when I point to the first ViroARImageMarker I can see the 3dObject and hear the sound, then I point to the second ViroARImageMarker and I can see the video, the 3dObject dissapear but the sound still hearing.

This works ok on Android but on iOS we have this issue.

Next is a example code to reproduce it. We need to have our app on production asap but it only works on Android now.

Thanks.

Reproducible Demo

`import React, {useState} from 'react'; import SplashScreen from 'react-native-splash-screen' import {ViroARScene, ViroARSceneNavigator, Viro3DObject, ViroAmbientLight, ViroARTrackingTargets, ViroARImageMarker, ViroVideo, ViroNode, ViroSound, ViroImage} from '@viro-community/react-viro';

const MagazineSceneAR = () => { const [actualModal, setActualModal] = useState(null); const [initSound, setInitSound] = useState(true); const [pauseUpdates, setPauseUpdates] = useState(false);

SplashScreen.hide();

ViroARTrackingTargets.createTargets({ sn1 : { source : {uri : 'https://www.revistalagunas.com/app/assets/1/tapa/tapa-1.jpg'}, orientation : 'Up', physicalWidth : 0.21 }, vd1 : { source : {uri : 'https://www.revistalagunas.com/app/assets/1/portada/portada.jpg'}, orientation : 'Up', physicalWidth : 0.1224 } })

function onInitialized(state, reason) {}

function _onAnchorFound(objId) { console.log(objId, actualModal); if (actualModal !== objId) { console.log('Changing to ' + objId); setActualModal(objId); setPauseUpdates(false); } }

function _startLoadingImg(){ setInitSound(true); }

function _endLoadingImg(){ setInitSound(false); setPauseUpdates(true); }

return (

_onAnchorFound('sn1')} pauseUpdates={pauseUpdates}> {actualModal == 'sn1' ? _startLoadingImg('sn1')} onLoadEnd={() => _endLoadingImg('sn1')} /> : null} _onAnchorFound('vd1')} pauseUpdates={pauseUpdates}> {actualModal == 'vd1' ? : null}

); };

export default () => { return ( <ViroARSceneNavigator autofocus={true} initialScene={{ scene: MagazineSceneAR, }} style={{flex: 1}} /> ); }; `