Playing movies in StandAlones

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
maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Playing movies in StandAlones

Post by maxs » Thu Nov 19, 2009 8:32 am

OK I can play a movie from a seperate folder in my pre-stand alone. But it stops working when I make a standalone. Is the file path for a standalone different?
Here is the script, Any help would be appreciated. Max

on mouseUp

show player "Player1"
select empty
put the effective filename of this stack into tPath
set itemdelimiter to "/"
delete last item of tpath--tMovieFileFullName
delete last item of tpath--tMovieFileFullName
set itemdelimiter to ","
put ( tPath & "/mov") after tMovieName
put "/" & the short name of this card & ".mov" after tMovieName
set the fileName of player "Player1" to tMovieName
start player "Player1"
unlock screen
end mouseUp

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Post by trevordevore » Thu Nov 19, 2009 1:53 pm

Paths can change when you build a standalone for OS X since your stacks are placed inside of the application bundle. If you are using Rev 3.5 or later then you can use relative paths as the Revolution engine will search for movies relative to the stack starting with that version.

The video player tutorial on the lessons.runrev.com site has an example of this. Maybe it will help.

http://lessons.runrev.com/spaces/lesson ... m-the-Menu
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Not Quite Working

Post by maxs » Thu Nov 19, 2009 11:41 pm

Thank you Trevor,

"Relative" does work if the video folder is in the folder as the App.
Alas, the video folder has to be outside the folder containing the app in order to be accessed by both Windows and Mac platforms.

So how can I get the path for the folder outside the app folder?
I can get it for the pre-standalone, but it stops working in the stand alone version.

Max

BTW, your video workshop series looks terrific.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Post by trevordevore » Fri Nov 20, 2009 4:54 am

If I understand what you are trying to do correctly relative paths should still work for you. It sounds like you have a single stack that you are building an executable with. Is that correct? When a player object looks for a relative path it will look in the folder the player's stack is located in and then in the app folder (the folder with the .exe or the .app file). Have you tried using a relative path yet?

So why is the path different when building a standalone vs the IDE? When you build a standalone on OS X your stack is combined with the engine to form the executable. This executable is store inside of the application bundle that gets created. If your application is named MyApp.app the executable is actual stored in the ./MyApp.app/Contents/MacOS/ folder. Right-click on the application bundle in the Finder and select "Show Package Contents" to see the actual contents of the application bundle.

What this means is that the code:

Code: Select all

put the effective filename of this stack into tPath 
is returning a path that looks similar to this:
/Users/myusername/myfolder/MyApp.app/Contents/MacOS/MyApp

It sounds like your video folder is stored alongside the application bundle though which is why the videos are not found. If you want to use a full path uou just need to update your code to remove application bundle portion of the path if it is present.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Playing movies in StandAlones

Post by maxs » Sun Nov 22, 2009 5:16 am

Hi Trevor,

The path to the video in the video folder is just "Videos/Videoname.mov." The folder is outside the application folder for the Mac Version, in order for the videos to be accessable to the IBM version.
It works in the pre-SA , but not in the SA. The effective filename for the pre-SA app and the SA app returns the same path. I see no difference that can be removed.
I don't know how to remove the application bundle portion of the path.

Stumped, Max

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Playing movies in StandAlones

Post by maxs » Sun Nov 22, 2009 6:18 am

OK, I tried it with just using 'the filename '
Again, it works in the pre-standalone , but not the standalone.
How can I edit 'the filename ' to get the correct path?
Max

(I don't mean to impose on you, Trevor. Perhaps anyone can help me with this problem. Max)

put the filename of this stack into tPath
set itemdelimiter to "/"
delete last item of tpath--tMovieFileFullName
put ( tPath & "/Videos") after tMovieName
put "/" & "Splash.mov" after tMovieName
set the fileName of player "Player1" to tMovieName-- (the short name of this card & ".mov" )
start player "Player1"

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Playing movies in StandAlones

Post by Mark » Sun Nov 22, 2009 9:48 am

Hi Max,

Does it help if you use the effective filename of this stack instead of the filename of this stack?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 421
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Playing movies in StandAlones

Post by maxs » Sun Nov 22, 2009 6:36 pm

Yes, using 'Relative' works. Thank you.

I don't know why it didn't work the first time I tried it.

Thank you, Trevor, too.

Max

Post Reply

Return to “Multimedia”