QT playback of remote files

J. Landman Gay jacque at hyperactivesw.com
Tue Jul 16 22:55:49 EDT 2013


My project loads a player with a URL to a remote audio file on a fast 
server like this:

set the filename of player 1 to https://xxx.xxx.xxxx.m4a
start player 1

Sometimes it works fine, but frequently nothing plays. I think, but am 
not positive, that I've traced it to an issue where the player tries to 
start but the downloaded temp file doesn't have enough data yet to play. 
When that happens, the player reports that it's paused property is 
false, and the result is empty, so I think it's trying to play an empty 
(or minimal) file. It won't play, pause, or restart after that unless I 
re-load the URL, and when I do, it plays just fine.

If I introduce a brief wait it works almost all the time:

set the filename of player 1 to https://xxx.xxx.xxxx.m4a
wait 100 milliseconds
start player 1

But occasionally that fails too. If I increase the wait to 300 
milliseconds it seems to always work, but there's a noticeable delay in 
playback which is undesirable. I'm also thinking that the wait will 
probably need to vary depending on the state of the current network 
connection.

My questions:

Is my diagnosis correct?

Shouldn't the player take care of all that by itself? I.e., start 
playing as soon as possible? If I start it too soon, it hangs and never 
plays.

Is there a way for the script to know when enough data has been received 
so I know how long to wait?

LiveCode 6.1, if that makes a difference. I'm aware of the open sockets 
issue that https can cause, but there are never any open sockets when I 
check.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list