Thanks for Media / MP3 playback question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
FrankR
Posts: 28
Joined: Mon Apr 10, 2006 2:10 pm

Thanks for Media / MP3 playback question

Post by FrankR » Mon Apr 10, 2006 2:13 pm

First - thanks for Media. I had evaluated RunRev in the past, and now I'm back with another project idea that Media might be the fit for.

While playing back MP3's, can I script:
- the start and stop time of a Segment of an MP3
- the number of times to Loop the segment
?

Thanks.

FrankR
Posts: 28
Joined: Mon Apr 10, 2006 2:10 pm

Post by FrankR » Tue Apr 11, 2006 12:48 pm

Bueller?

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Post by marielle » Tue Apr 11, 2006 1:58 pm

Hi Frank,

I don't really use mp3 much. You will need to check out whatever I say and perhaps adapt the code to get it work.

In the doc, you need to look under "play" (dictionary)

Code: Select all

play "/usr/local/clips/music.aiff" -- a file
play videoClip "Movie" at 100,100 -- an imported video clip
play audioClip "Trust No One" looping
from the doc:
If you use the play...looping form, the sound or video plays continuously from start to beginning until you stop it.
if you kow how long it takes to make a single loop, then you can stop it after a given number of loops.

Code: Select all

send stopmovie to me in tmovietime seconds
on stopmovie
    stop playing audioClip "my audio clip" 
end stopmovie

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Tue Apr 11, 2006 8:35 pm

Hi Frank,

if you want to use MP3 in your stacks, you need to use a player object. MP3 is not supported as an audioclip.
You can set the currenttime of the player and might be nterested in their callbacks property.

Hope that helps,

Malte

pevensen
Posts: 21
Joined: Mon Apr 10, 2006 2:50 pm
Location: St. Louis, MO, USA
Contact:

Re: Thanks for Media / MP3 playback question

Post by pevensen » Wed Apr 12, 2006 4:53 pm

FrankR wrote:First - thanks for Media. I had evaluated RunRev in the past, and now I'm back with another project idea that Media might be the fit for.

While playing back MP3's, can I script:
- the start and stop time of a Segment of an MP3
- the number of times to Loop the segment
?

Thanks.
You can set the start and stop time on a Player object, which you use to play an mp3 file, using startTime, endTime, and playSelection. You may also need duration and timeScale to figure out the desired values for startTime and endTime.

As far as looping only a number of times, I'm not sure there's an automated way to do it.

You could set up a handler on the player something like:

Code: Select all

on playStopped
    set the cpTimesToPlay of me to the cpTimesToPlay of me - 1
    if the cpTimesToPlay of me > zero then
        set the currentTime of me to the startTime of me
        start me
    end if
end playStopped
You would have previously had to set the cpTimesToPlay of your player to the number of times.
Peter Evensen
[url]http://www.PetersRoadtoHealth.com[/url]

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”