Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

does expo av support mp3

import * as React from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
import { Audio } from 'expo-av';

export default function App() {
  const [sound, setSound] = React.useState();

  async function playSound() {
    console.log('Loading Sound');
    const { sound } = await Audio.Sound.createAsync(
       require('./assets/Hello.mp3')
    );
    setSound(sound);

    console.log('Playing Sound');
    await sound.playAsync(); }

  React.useEffect(() => {
    return sound
      ? () => {
          console.log('Unloading Sound');
          sound.unloadAsync(); }
      : undefined;
  }, [sound]);

  return (
    <View style={styles.container}>
      <Button title="Play Sound" onPress={playSound} />
    </View>
  );
}

const styles = StyleSheet.create({ ... });
Comment

PREVIOUS NEXT
Code Example
Javascript :: Change slick slider slides from another component 
Javascript :: if spreeding the properties on an input how to nnot include the invalid props that the input is not receiving 
Javascript :: row no datatable 
Javascript :: move_uploaded_file equivalent in js 
Javascript :: inheritence in javascript 
Javascript :: how to add header to axios request 
Javascript :: capitalize last letter javascript 
Javascript :: express.js routing 
Javascript :: window handles 
Javascript :: deletenode javascript 
Javascript :: javascript coding problems 
Javascript :: suscribe messagechannel lwc 
Javascript :: transform js to typescript 
Javascript :: add decimal places to number javascript 
Javascript :: tthree js npm 
Javascript :: sort used in price high and low using angular 
Javascript :: js get data from liocalstorage 
Javascript :: return the remainder from two numbers javascript 
Javascript :: mongodb-nodejs-driver, DeprecationWarning: collection.count is deprecated 
Javascript :: javascript axios response.data.pipe not a function 
Javascript :: Angularjs different dependency injection for factories inside controller 
Javascript :: call method from parent 
Javascript :: set default value in dynamic dropdown angularjs 
Javascript :: Using animateCamera in functional components in react native 
Javascript :: javascript array add method 
Javascript :: flatten a nested json 
Javascript :: insert image in jsp page 
Javascript :: nodejs passport starter template with username and password 
Javascript :: Creating A Promise With JSON 
Javascript :: string to date with ist javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =