Using videos
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Using videos
Question: I am designing a program that shows videos. I used the Import As Control feature to have videos embedded in the cards. However, I would rather use QuickTime Player, but that always seem to want to get the videos from an outside source. Any suggestions?
Re: Using videos
Hi,
You can always use the video files imported as a control by first writing them out to temporary file location and use the "filename" command to assign to the player object.
you can ping for a sample file, not at my usual machine hence can't post sample now
kotikoti
You can always use the video files imported as a control by first writing them out to temporary file location and use the "filename" command to assign to the player object.
you can ping for a sample file, not at my usual machine hence can't post sample now
kotikoti
Build 160
Version 2.9.0
Platform: Windows
Version 2.9.0
Platform: Windows
Re: Using videos
If you could send be a sample code, that would be great.
Re: Using videos
Hi Kotikoti,
I am very new to runrev (though purchased it many yrs back) and could use all the help i can get for this. Similar to doctanx, Im trying to create a program that plays videos. In the end, the program will be standalone app that will play videos. I created a simple stack that had a quicktime player and i specified the video (source). It plays in run mode but when saved as a standalone the vid doesnt even appear (nor does the control bar to press play).
I have read just about every post regarding videos and feel lost. Could you help me and also post the sample code for this? Once i can atleast get this simple example to work i wanted to make something that could play the video automatically when starting the app (like credits) then goto next card.
I use RuntimeRevolution Version 2.6.1 Build 152 for Mac OSX (i believe its rev studio).
I am very new to runrev (though purchased it many yrs back) and could use all the help i can get for this. Similar to doctanx, Im trying to create a program that plays videos. In the end, the program will be standalone app that will play videos. I created a simple stack that had a quicktime player and i specified the video (source). It plays in run mode but when saved as a standalone the vid doesnt even appear (nor does the control bar to press play).
I have read just about every post regarding videos and feel lost. Could you help me and also post the sample code for this? Once i can atleast get this simple example to work i wanted to make something that could play the video automatically when starting the app (like credits) then goto next card.
I use RuntimeRevolution Version 2.6.1 Build 152 for Mac OSX (i believe its rev studio).
Re: Using videos
Hi folks,
when a standalone does not find the videos that have been playing fine in the IDE it is almost always a
pathname problem especially on OS X!
I am sure that you do not use absolute pathnames like:
"/Users/klaus/Documents/videos/bikes.mov" on OS X or
"C:/Folder1/videos/bikes.mov" on Windows
If you do then this will of course only work on the machine where you created the stack(s)!
The trick is to use relative (to the stack) pathnames throughout!
Like this:
1. You have stack "videoplayer.rev" somewhere on your hd where you want to display videos in a player object.
2. (This part is optional, but subfolder make your app look a but cleaner than a lot of files in the "rootlevel" folder
)
Create a folder "videos" (or whatever) in the same folder as your stack and put/copy all the necessary video files into
this new folder.
3. In the IDE select a filename for you player object(s) with the "folder" button in the inspector.
This will put an absolute pathname into the "filename" field in the inspector.
4. Delete everything but "videos/name of video.mov" in that field, the player will still display the correct video,
since starting with Rev 3 (? not sure) Rev will also search for videos and images relative to the stack! Sorry,
this will not work with Rev 2.6x, sorry tkhedrup!
5. After creating the standalone you need to
a. (Windows) put the folder "videos" into the same folder as your standalone and it will work fine!
b. (OS X) this is a bit different due to the architecture of a Mac standalone which is indeed a folder!
Right-click on the standalone and choose "Show contents", this will open the app "folder" and you will
see another folder "Contents". Open this folder and you will find more folder including the folder "MacOS".
Inside of this folder "MacOS" you will find a file named "Revolution" which is/was the stack you turned into the standalone.
Now copy the folder "videos" into the folder "MacOS" and everything will be fine, since the videos are now in the
folder "videos" relative to your stack!
If you cannot or want (for whatever reason) to have the videos in a folder you can store the files in a custom property
in your stack and write it down to the users hd when needed and set the filename of a player object to that file.
Like this:
1. Import a video into a customproperty:
...
answer file "Select a video:"
set the my_video1 of stack "videplayer" to url("binfile:" & it)
...
Now the (binary, that's why we cannot use fields ofr this purpose!) video file is part of your stack.
2. "Spit" it out when needed, use the temporary folder for this purpose. I use the seconds in the filenmae for this
"temporary" file, so there is very few risk to overwrite a file wiht the same filename:
...
put specialfolderpath("temporary") & "/" & the seconds & ".mov" into the_temp_filename
put the my_video1 of stack "videoplayer" into url("binfile:" & the_temp_filename)
set the filename of player "xyz" to the_temp_filename
...
This is of course not feasable for lengthy videos with a BIG fielsize, since Rev load the COMPLETE stack into memory!
Well. that's it basically
Hope that helps.
Best from germany
Klaus
when a standalone does not find the videos that have been playing fine in the IDE it is almost always a
pathname problem especially on OS X!
I am sure that you do not use absolute pathnames like:
"/Users/klaus/Documents/videos/bikes.mov" on OS X or
"C:/Folder1/videos/bikes.mov" on Windows
If you do then this will of course only work on the machine where you created the stack(s)!

The trick is to use relative (to the stack) pathnames throughout!
Like this:
1. You have stack "videoplayer.rev" somewhere on your hd where you want to display videos in a player object.
2. (This part is optional, but subfolder make your app look a but cleaner than a lot of files in the "rootlevel" folder

Create a folder "videos" (or whatever) in the same folder as your stack and put/copy all the necessary video files into
this new folder.
3. In the IDE select a filename for you player object(s) with the "folder" button in the inspector.
This will put an absolute pathname into the "filename" field in the inspector.
4. Delete everything but "videos/name of video.mov" in that field, the player will still display the correct video,
since starting with Rev 3 (? not sure) Rev will also search for videos and images relative to the stack! Sorry,
this will not work with Rev 2.6x, sorry tkhedrup!
5. After creating the standalone you need to
a. (Windows) put the folder "videos" into the same folder as your standalone and it will work fine!
b. (OS X) this is a bit different due to the architecture of a Mac standalone which is indeed a folder!
Right-click on the standalone and choose "Show contents", this will open the app "folder" and you will
see another folder "Contents". Open this folder and you will find more folder including the folder "MacOS".
Inside of this folder "MacOS" you will find a file named "Revolution" which is/was the stack you turned into the standalone.
Now copy the folder "videos" into the folder "MacOS" and everything will be fine, since the videos are now in the
folder "videos" relative to your stack!
If you cannot or want (for whatever reason) to have the videos in a folder you can store the files in a custom property
in your stack and write it down to the users hd when needed and set the filename of a player object to that file.
Like this:
1. Import a video into a customproperty:
...
answer file "Select a video:"
set the my_video1 of stack "videplayer" to url("binfile:" & it)
...
Now the (binary, that's why we cannot use fields ofr this purpose!) video file is part of your stack.
2. "Spit" it out when needed, use the temporary folder for this purpose. I use the seconds in the filenmae for this
"temporary" file, so there is very few risk to overwrite a file wiht the same filename:
...
put specialfolderpath("temporary") & "/" & the seconds & ".mov" into the_temp_filename
put the my_video1 of stack "videoplayer" into url("binfile:" & the_temp_filename)
set the filename of player "xyz" to the_temp_filename
...
This is of course not feasable for lengthy videos with a BIG fielsize, since Rev load the COMPLETE stack into memory!
Well. that's it basically

Hope that helps.
Best from germany
Klaus
Re: Using videos
Here's the promised file, hope you find it useful.
Klaus, Thanks for your note, I didn't know I could use a custom property for this as well. Thanks
Klaus, Thanks for your note, I didn't know I could use a custom property for this as well. Thanks
- Attachments
-
- Working with videoclips.zip
- (4.75 KiB) Downloaded 315 times
Build 160
Version 2.9.0
Platform: Windows
Version 2.9.0
Platform: Windows