1
  //PLaying Sound
  async function playSound() {
    console.log('Loading Sound');

    const { sound} = await Audio.Sound.createAsync(route.params.url,
    );
    setSound(sound);
    setsound1(false)
sound.setOnPlaybackStatusUpdate(playback_staus_update)

    console.log('Playing Sound');
     sound.setPositionAsync(1500)
     sound.playAsync()
    setsound1(false)

      
//Playback Status Upadte
var y=0
async function playback_staus_update(){
  if(sound!=undefined){
    var x=await sound.getStatusAsync()
     
    console.log(x)
    if(x.isPlaying){
      y++
    
    setcurrentaudposition(x.positionMillis)
    }else{
      console.log('Audio Stopped!');
      if(y>1){
        setsound1(true)
        
      }
    }
  }
 
  }
 //Playback Status Upadte


when playSound() is called instead of audio getting played from 1500 ms it starts to play from 0 millisecond enter image description here In start the position is set to 1500 but when the audio starts playing it starts from 0.

Trying to set position of an audio to specific duration using
"await sound.setPositionAsync()" but instead it play from 0 millisecond.

  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Mario Mateaș Feb 16 '23 at 04:48
  • I trimmed the code. If you could help me with it now – UTKARSH RANA Feb 18 '23 at 22:12

0 Answers0