I have a list field with music files in it.
I have a button with the following script that I want to start the player at line 1 and play everything in the field one at a time for it's complete duration.
Whenever I click the button, only the last line in the list plays. What am I neglecting this time?
on mouseup
repeat for each line theline in fld "playlist"
set the filename of player "myplayer" to theline
start player "myplayer"
wait until the sound is done -- seems like this would be correct
end repeat
end mouseup
Player repeat loop
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Player repeat loop
Hi oldummy,
this line
will only work with sounds started with the "play audioclip xyz" command, but NOT with player objects!
You could add a "on playstopped" handler to your card with the player and set the filename to the next
line in your field.
Know what I mean?
Best
Klaus
P.S.
Please use the CODE tags after pasting your script here!
this line
Code: Select all
wait until the sound is done
You could add a "on playstopped" handler to your card with the player and set the filename to the next
line in your field.
Know what I mean?
Best
Klaus
P.S.
Please use the CODE tags after pasting your script here!
Code: Select all
on mouseup
repeat for each line theline in fld "playlist"
set the filename of player "myplayer" to theline
start player "myplayer"
wait until the sound is done -- seems like this would be correct
end repeat
end mouseup
Re: Player repeat loop
Hi oldummy --
Last spring I built a LiveCode stack that creates a playlist from my archive of .mp3 music files stored on disk. Although perhaps a bit more elaborate than what you need -- in my case, the stumbling block was employing callbacks with a player object to advance a progress bar, which the incredible folks here on the forums helped me to solve -- I believe that it accomplishes you are trying to do.
At the time I uploaded a working version of that stack to the forum. You can still find it there:
https://forums.livecode.com/viewtopic.p ... 75#p222307
I've since removed from my server the set of short .mp3 files mentioned in that post, but I'm sure you have your own that you can use to test this out. The scripts include detailed comments, so hopefully you can locate in the code the routines that are most relevant to what you are trying to achieve.
Best wishes,
jeff k
Last spring I built a LiveCode stack that creates a playlist from my archive of .mp3 music files stored on disk. Although perhaps a bit more elaborate than what you need -- in my case, the stumbling block was employing callbacks with a player object to advance a progress bar, which the incredible folks here on the forums helped me to solve -- I believe that it accomplishes you are trying to do.
At the time I uploaded a working version of that stack to the forum. You can still find it there:
https://forums.livecode.com/viewtopic.p ... 75#p222307
I've since removed from my server the set of short .mp3 files mentioned in that post, but I'm sure you have your own that you can use to test this out. The scripts include detailed comments, so hopefully you can locate in the code the routines that are most relevant to what you are trying to achieve.
Best wishes,
jeff k
Re: Player repeat loop
I thank you both for the your help with this. And I really appreciate your album stack jmk. I'm afraid it was a little too far over my head at this time, but I intend to use it to learn about callbacks, as I know nothing about them yet.
I did use KI did use klaus's suggestion and went with the playstopped method. It works until I find a way to break it.
I did use KI did use klaus's suggestion and went with the playstopped method. It works until I find a way to break it.