Using player objects in IDE and Standalone

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DougN
Posts: 20
Joined: Wed Mar 04, 2009 4:09 am

Using player objects in IDE and Standalone

Post by DougN » Fri Feb 12, 2010 10:32 am

Hi,

I'm trying to use Player Objects to play simple .mov sound files. I want to play them while I'm designing, working in the IDE, and then, when I create a standalone, I want them to play there.

I'm not having luck with this. If I use the "Browse..." function to relate the player to the sound file, the files don't play when I create a standalone. Presumably because the absolute path isn't converted to a relative one. Illustration:

Image

If I input a relative path in the IDE's window, then I can get the files to play from the standalone. But they won't play within the IDE, so it's difficult to make design decisions. Illustration:

Image

How can I get Rev to play the file in the IDE and from the standalone? Do I need to do scripting gymnastics to parse path and filenames, or is there a built-in way for this to "just work?"

Thanks,
Doug

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Using player objects in IDE and Standalone

Post by Dixie » Fri Feb 12, 2010 11:31 am

Hey Doug...

When you run this it will set the defaultFolder to the folder in which the referenced stack resides:-

Code: Select all

  set itemDel to "/"
  put item 1 to -2 of (the effective fileName of this stack) into theDefaultFolder
  set the defaultfolder to theDefaultFolder
Insert this code into the preOpenStack or openStack handler, and then files that reside in the same folder as the stack can be accessed by using the relative path to the file.

If you use this under MacOSX in a standalone application, the defaultFolder will be set to a folder inside the application package.... for example.... myApp.app/Contents/MacOS. If you don't set the defaultFolder in the standalone, it will be set to the folder containing the application package.

be well

Dixie

DougN
Posts: 20
Joined: Wed Mar 04, 2009 4:09 am

Re: Using player objects in IDE and Standalone

Post by DougN » Fri Feb 12, 2010 5:24 pm

Dixie,

Thank you for the quick reply!

Incorporating the code you provided, I was able to manually enter relative references to load sounds into Player objects in the IDE, and have them play in the IDE.

When I went to make the standalone, I commented out the code, saved the stack, and built the standalone. The sounds linked correctly to the Player objects.

So just to confirm, am I correct in following that procedure... using the code while I'm working in the IDE, and then commenting it out before building the standalone?

Also, will this approach work for standalones built for Windows?

Thanks,
Doug

Post Reply

Return to “Multimedia”