How to use the expo-av.Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS function in expo-av

To help you get started, we’ve selected a few expo-av examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SCasarotto / casarotto-chat / src / pages / Loading / Loading.js View on Github external
} = settings

		firebase.initializeApp({
			apiKey: FIREBASE_API_KEY,
			authDomain: FIREBASE_AUTH_DOMAIN,
			databaseURL: FIREBASE_DATABASE_URL,
			projectId: FIREBASE_PROJECT_ID,
			storageBucket: FIREBASE_STORAGE_BUCKET,
			messagingSenderId: FIREBASE_MESSAGING_SENDER_ID,
		})

		const { startLoadingProcess, navigation } = this.props
		startLoadingProcess(navigation)
		Audio.setAudioModeAsync({
			allowsRecordingIOS: false,
			interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS,
			playsInSilentModeIOS: true,
			shouldDuckAndroid: true,
			interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS,
			playThroughEarpieceAndroid: false,
			staysActiveInBackground: false,
		})
			.then((response) => {
				// console.log('Audio Mode Setup')
			})
			.catch((error) => console.log(error))
	}
github SCasarotto / casarotto-chat / src / pages / Main / AudioCustom.js View on Github external
//If playing - stop
		if (soundObject) {
			soundObject
				.stopAsync()
				.then(() => {
					return soundObject.unloadAsync()
				})
				.then(() => {})
				.catch((error) => console.log(error))
		}

		//If id id different than last id play new
		if (playingRecording !== _id) {
			Audio.setAudioModeAsync({
				allowsRecordingIOS: false,
				interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS,
				playsInSilentModeIOS: true,
				shouldDuckAndroid: true,
				interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS,
				playThroughEarpieceAndroid: false,
				staysActiveInBackground: false,
			})
				.then(() => {
					const newSoundObject = new Audio.Sound()
					newSoundObject
						.loadAsync({ uri: audio })
						.then((response) => {
							newSoundObject.setOnPlaybackStatusUpdate((statusData) => {
								const { didJustFinish } = statusData
								if (didJustFinish) {
									this.setState({ playingRecording: '', soundObject: undefined })
								}
github SCasarotto / casarotto-chat / src / pages / Main / Main.js View on Github external
.catch((error) => {
				console.log(error)
				Audio.setAudioModeAsync({
					allowsRecordingIOS: false,
					interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS,
					playsInSilentModeIOS: true,
					shouldDuckAndroid: true,
					interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS,
					playThroughEarpieceAndroid: false,
					staysActiveInBackground: false,
				})
			})
	}
github expo / expo / apps / native-component-list / src / screens / AV / AudioModeSelector.ios.tsx View on Github external
valueName: 'staysActiveInBackground',
          disabled: !this.state.modeToSet.playsInSilentModeIOS,
          value: !this.state.modeToSet.playsInSilentModeIOS ? false : undefined,
        })}
        {this._renderModeSelector({
          title: 'Mix with others',
          value: Audio.INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS,
        })}
        {this._renderModeSelector({
          title: 'Do not mix',
          value: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
        })}
        {this._renderModeSelector({
          disabled: this.state.modeToSet.playsInSilentModeIOS === false,
          title: 'Duck others',
          value: Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS,
        })}
        <button disabled="{this._modesEqual(this.state.modeToSet," style="{{" title="Apply changes">
      
    );
  }
}</button>
github SCasarotto / casarotto-chat / src / pages / Main / Main.js View on Github external
handleStartAudioRecording = () => {
		Audio.setAudioModeAsync({
			allowsRecordingIOS: true,
			interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS,
			playsInSilentModeIOS: true,
			shouldDuckAndroid: true,
			interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS,
			playThroughEarpieceAndroid: false,
			staysActiveInBackground: false,
		})
			.then((response) => {
				return Permissions.askAsync(Permissions.AUDIO_RECORDING)
			})
			.then((response) => {
				const { status, expires, permissions } = response
				if (status === 'granted') {
					const newRecording = new Audio.Recording()
					newRecording
						.prepareToRecordAsync(Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY)
						.then((response) => {
github expo / expo / home / screens / AudioDiagnosticsScreen.tsx View on Github external
value={audioMode.staysActiveInBackground}
          disabled={!isAudioEnabled || !audioMode.playsInSilentModeIOS}
          onValueChange={value =&gt; {
            const newAudioMode = { ...audioMode, staysActiveInBackground: value };
            setAudioMode(newAudioMode);
          }}
        /&gt;
      ) : null}
       {
          const newAudioMode = { ...audioMode, interruptionModeIOS: value };
          setAudioMode(newAudioMode);
        }}
      /&gt;
    
  );
}