SA-MP Forums Archive
PlayAudioStreamForPlayer delay - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PlayAudioStreamForPlayer delay (/showthread.php?tid=324442)



PlayAudioStreamForPlayer delay - Austin - 09.03.2012

Hey SA-MP,

When using PlayAudioStreamForPlayer, if there is a one stream already playing, and you try to start a second one, there is a delay inbetween.

It seems to be that the first stream stops instantly, and the second stream buffers before playing.

Would it be possible to wait for the second stream to buffer before you cut the first stream? This would make the audio flow smoothly.

Here is an example video of the delay.

[ame]http://www.youtube.com/watch?v=SdKPXyTIUCY[/ame]


Re: PlayAudioStreamForPlayer delay - MP2 - 09.03.2012

This is the first SA:MP video I've ever watched with a voiceover, normally it's subtitles, lol

Some callbacks for when a stream starts/ends would be nice, also.

P.S. Awesome script


Re: PlayAudioStreamForPlayer delay - Infamous - 09.03.2012

Does need a fix indeed and nice script you got there!


Re: PlayAudioStreamForPlayer delay - KingHual - 09.03.2012

Though, this delay appears because of the buffer time, like in ******* videos, you need to wait a sec. or two for the video to load. And to be removed, SA:MP would need to use multithreading (You know - to continue playing the previous stream while the new stream is buffering), which I don't think is a good idea.


Re: PlayAudioStreamForPlayer delay - jamesbond007 - 09.03.2012

wow awesome script... good job man


Re: PlayAudioStreamForPlayer delay - Austin - 12.03.2012

My only reason for thinking it might be possible is that you buffer the stream already, so I was hoping the rest of the buffer could be played before playing the new sound, rather than just cutting it off.


Re: PlayAudioStreamForPlayer delay - xxmitsu - 12.03.2012

I don't know how the system was implemented: if the stream is loaded each and every time is needed or just the first time.

But if it's the first scenario, then I guess it could be done if samp devs offered the possibility to preload all the needed audio streams, and then, just send the command to the client of which stream to play.


Re: PlayAudioStreamForPlayer delay - leong124 - 12.03.2012

You can hardly stream audios before stopping another, since it is possible to buffer a stream with nearly no delay (local?) and seems that SA-MP's audio function can only stream 1 audio, unlike audio plugin.


Re: PlayAudioStreamForPlayer delay - Kalcor - 12.03.2012

As the function name suggests, it's designed to play audio streams (mainly internet radio). It can play audio files only because a shoutcast stream and an MP3 stream are the same thing.

I will have a look at it, but to be honest, SA-MP isn't very big on custom content. We're trying to keep everything in SA-MP close to the original San Andreas.


Re: PlayAudioStreamForPlayer delay - Austin - 14.03.2012

I really appreciate the honesty Kalcor, I know that it's not the supposed use for it, but the soccer script is a great testament to coding freedom, and the sound part would be the icing on the cake.