Playing movies in StandAlones
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Playing movies in StandAlones
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
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
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
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
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
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
Not Quite Working
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.
"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.
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
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:
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.
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
/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
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
Re: Playing movies in StandAlones
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
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
Re: Playing movies in StandAlones
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"
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"
Re: Playing movies in StandAlones
Hi Max,
Does it help if you use the effective filename of this stack instead of the filename of this stack?
Mark
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Playing movies in StandAlones
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
I don't know why it didn't work the first time I tried it.
Thank you, Trevor, too.
Max