Naive Player Questions

panagiotis merakos merakosp at gmail.com
Tue Dec 5 08:17:07 EST 2017


Hi Graham,

In short:

*- embedding an MP3, or alternatively providing a path to the default
folder for the MP3 file for standalone creation*

Include the .mp3 file (say "myFile.mp3") in the "Copy Files" section. This
will be accessible from the **standalone** using the
<specialFolderPath("resources")> function.

* - starting the player*

on mouseUp
   local tFilename
   put specialfolderpath("resources") & slash & "myFile.mp3" into tFilename
  // NOTE: In the IDE you'll need the full path to your "myFile.mp3"
   set the filename of player 1 to tFilename
   start player 1
end mouseUp

* - monitoring the player to see if it’s still running*

You can do that by checking "the playmate of player 1". If it is 0, then
the player does not play

 - doing other stuff while it’s running

You can do other stuff without problems, as the player does not block them

 - being told when it’s stopped.

Use the "playStopped" message

Hope this helps,
Panos
--

On Tue, Dec 5, 2017 at 11:51 AM, Graham Samuel via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Thanks Panos - I know that. I am however looking for comprehensive
> instructions as to how to use a player object via script, e.g
>
>  - embedding an MP3, or alternatively providing a path to the default
> folder for the MP3 file for standalone creation
>  - starting the player
>  - monitoring the player to see if it’s still running
>  - doing other stuff while it’s running
>  - being told when it’s stopped.
>
> AFAIKS none of this is clear in the documentation. If true, this is a big
> omission!
>
> Cheers
>
> Graham
> PS - I imagine I’m not the only one to want to play MP3s because the are
> vastly smaller than the LC ‘native’ sound formats. I don’t like to make
> apps unnecessarily large, especially if they’re going to be delivered via
> the Internet.
>
> > On 5 Dec 2017, at 12:13, panagiotis merakos via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Hi all,
> >
> > The command "play <filename> ' on desktop plays the file as an audioclip,
> > and audio clips can be in WAV, AIFF, or AU format. If you want to play an
> > mp3 file, you have to use a player object.
> >
> > Best,
> > Panos
> > --
> >
> > On Tue, Dec 5, 2017 at 11:06 AM, Richmond Mathewson via use-livecode <
> > use-livecode at lists.runrev.com> wrote:
> >
> >> Happy, Happy 5th of December: by sheer chance I stumbled on how to do
> this
> >> . . .
> >>
> >> In fact the whole thing is dead easy (not, admittedly clear from the
> >> Dictionary).
> >>
> >> http://forums.livecode.com/viewtopic.php?f=7&t=30258&p=161069#p161069
> >>
> >> Best, Richmond.
> >>
> >> On 5/12/17 12:47 am, Graham Samuel via use-livecode wrote:
> >>
> >>> Hi - perhaps due to not picking the right search terms in the
> >>> documentation, I am confused about playing audio files in LC 8. What I
> want
> >>> seems quite simple to me: I want the user to click a button which will
> >>> cause a single MP3 file to play. While it plays I may or may not want
> to
> >>> switch cards or use visual effects. When it stops, I want to take back
> >>> control and move the program onto something else.
> >>>
> >>> It appears that I have to use a player object to play MP3s, since the
> >>> “play” comment will only play aiffs. OK, so I can create a player
> object,
> >>> but I want to embed my MP3 file into it (since I have no need to play
> more
> >>> than one file), I want to start it, and I want the option to do stuff
> while
> >>> it’s playing, and I certainly want to do stuff when it stops.
> >>>
> >>> The documentation is not good on this - there is no indication as to
> >>> whether you can embed files (if you can’t, what would the path to a
> file
> >>> included in the program look like - I can only see paths referring to
> files
> >>> in my development environment)? There is one reference in Beginner’s
> Guide
> >>> to a “play stopped” message, but there isn’t one in the User Guide. My
> old
> >>> friend “wait until the sound is done” seems to have died of old age.
> How do
> >>> I know when the sound is finished, or alternatively how can I know if
> it’s
> >>> still playing?
> >>>
> >>> Can anyone explain what I’m supposed to do, or (just as good) point me
> to
> >>> the right bit of LC documentation?
> >>>
> >>> TIA
> >>>
> >>> Graham
> >>> _______________________________________________
> >>> use-livecode mailing list
> >>> use-livecode at lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>>
> >>
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list