Xogy / xsound

Improved audio library for FiveM
MIT License
115 stars 82 forks source link

seekTo() is not an function #52

Closed TonyWilly closed 1 year ago

TonyWilly commented 1 year ago

Describe the bug While using setTimeStamp for any time amount I get: "[ 2729922] [b2802_GTAProce] CrBrowserMain/ Uncaught TypeError: this.yPlayer.seekTo is not a function (@xsound/html/scripts/SoundPlayer.js:320)" and also "[ 2730032] [b2802_GTAProce] CrBrowserMain/ Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'. (:0)" when I open log file.

To Reproduce Steps to reproduce the behavior: xsound = exports.xsound xsound:PlayUrl("localCar", url, 0.3, true) xsound:setTimeStamp("localCar", 30)

Expected behavior Seek to timestamp after playing

Screenshots image

Additional context I saw the #38 issue and I have ensured that I am using xsound-1.4.3 I also tried to research on the YouTube iframe and found this: player.seekTo(seconds:Number, allowSeekAhead:Boolean):Void So I tried to edit SoundPlayer.js to be: this.yPlayer.seekTo(time, true); but that didn't change the error.

TonyWilly commented 1 year ago

After testing, it seems this is just an issue of the player not being loaded before the set duration is called right way. Currently trying to figure out a good way to wait until the player has fully loaded...

Xogy commented 1 year ago

After testing, it seems this is just an issue of the player not being loaded before the set duration is called right way. Currently trying to figure out a good way to wait until the player has fully loaded...

Hey simply use event

onPlayStart("localCar", function()
     setTimeStamp("localCar", 30)
end)