Skip to content

Conversation

StrixG
Copy link
Contributor

@StrixG StrixG commented Nov 12, 2018

The setSoundPosition function can now be used with file streams and returns false if the position can't be set (e.g. the sound is a live stream or the buffer has not yet reached it).

@botder botder added the enhancement New feature or request label Nov 13, 2018
@ArranTuna
Copy link
Collaborator

I tested this and was unable to get it to work using an mp3 file please show test code that shows this PR working.

@StrixG
Copy link
Contributor Author

StrixG commented Dec 8, 2018

Test resource: sounds.zip

Video of the test: https://www.youtube.com/watch?v=uup8snl5UQk
Enter splayurl https://yamamichi.me/1.mp3, wait until the sound is downloaded and use spos 100.
Or just use this code:

local s = playSound("https://yamamichi.me/1.mp3")
print(setSoundPosition(s, 100)) -- false

setTimer(function ()
    print(setSoundPosition(s, 3)) -- true or false (depends on your internet connection)
end, 3000, 1)

addEventHandler("onClientSoundFinishedDownload", root, function (length)
    print(setSoundPosition(s, 120)) -- true
end)

@StrixG StrixG changed the title Allow setSoundPosition to be used with streams Allow setSoundPosition to be used with file streams Dec 20, 2018
Copy link
Contributor

@qaisjp qaisjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @StrixG - your test resource works perfectly. @ArranTuna - if you can sign-off that this works for you now, we can go ahead and merge this.

@qaisjp
Copy link
Contributor

qaisjp commented Feb 10, 2019

@ArranTuna any updates?

@ArranTuna
Copy link
Collaborator

Works.

@qaisjp qaisjp merged commit 4d4692e into multitheftauto:master Feb 10, 2019
@StrixG StrixG deleted the fix/setSoundPosition-streams branch September 7, 2019 23:00
@StrixG StrixG modified the milestones: 1.5.8, 1.5.7 Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants