Page 1 of 1
Using script to display imported video by ID
Posted: Sat Jan 05, 2008 4:02 pm
by reelstuff
Hello, I was searching through the documentation and the forum here for a way to use a button script to play a Video file that I imported into a stack, I can see the video is there and it plays when I click it in the application browser,
One little side note, it loads over the application browser and cannot be closed unless you close the app browser, (interesting behaviour)
but I digress.
What I want to do is to play that video by ID using a button on a card.
Update, I found that I can play the imported video clip,
Code: Select all
on mouseUp
play videoclip "myvideo.mov"
end mouseUp
However, there are no controls, is there a way to wrap the video in a player so there are controls, to pause play video?
Thanks in advance for any suggestions.
Posted: Sat Jan 05, 2008 7:21 pm
by Lynn P.
To my knowledge, you have to use a QT player object to hold the movie in order to access the controls or "badge" as it's called. The videoClip object has no such properties, it's simply an object that contains movie data. A player object offers much more control over playback.
You can either create it beforehand by dragging one from the Rev palette (or using the File menu) or do it by script.
If you place a player object on a card, you can tell it to play the movie file you imported to your stack via script:
Code: Select all
set the fileName of player "myPlayer" to "/myVideo.mov"
You can also type in "/myVideo.mov" into the player's inspector window.
Note the slash before the movie name which indicates the movie is contained in your stack. Read up on the player object in the docs for more info.

Posted: Sat Jan 05, 2008 8:10 pm
by reelstuff
thank you, I will try that out right away, I tried something like that but failed to put the / in front, that should cure it,
Tim
Posted: Sat Jan 05, 2008 9:14 pm
by reelstuff
thanks for the help, something must be off, tried several different methods of getting the video to play,
Used a script, to set file name, does not play,
tried entering /myvideo.mov into inspector, player framework show but video does not.
Not sure why this would be that difficult to manage, I am probably just missing something in the scripting.
I did check the documentation, which is version 1.0 a little behind the development of the tool,
I saw several methods but none would work with my version of rev which is 2.8.1
I am sure there must be a way to use video in a rev application without having to go through all these hoops,
thanks for the help, I will continue to look around to see if I can spot something that will do the trick.
Tim
Posted: Sun Jan 06, 2008 1:01 am
by BvG
the problem you have is most likely that there are two ways to use video in rev. the player object uses different commands then the player clip, and it's a bit hard to find them all. Here's a small sampling you can look up for details in the docu:
player object:
player
start
playStopped
currentTime
timeScale
stop
showBadge
showController
player clip:
play
movie
generally, the player object gives you more control, but needs a movie file in the disk.
Posted: Sun Jan 06, 2008 1:56 am
by Lynn P.
Hi Tim ~
I think I'm a bit confused about what exactly you want to do.
In your first post you said you wanted the controls available which is why you would set the fileName of a player object. This will load a movie into a player object, allowing the end user to start the movie using the controls. If you want the controls to just be there, but automatically start the movie without having the end user use the controls, put the following into your button script:
Code: Select all
on mouseUp
set the fileName of player "myPlayer" to "/myvideo.mov"
start player "myPlayer"
end mouseUp
You can also hide the controller from the user with "set the showBadge to false" if you want total control over the player object and not having the end user access to the movie controls. You can use all the other properties and commands of the player object to start, stop and pause the movie playing inside it.
From your last post... do you now want to play one movie, then play another one after it in the same player object?
Posted: Sun Jan 06, 2008 1:22 pm
by reelstuff
Lynn P. wrote:Hi Tim ~
I think I'm a bit confused about what exactly you want to do.
In your first post you said you wanted the controls available which is why you would set the fileName of a player object. This will load a movie into a player object, allowing the end user to start the movie using the controls. If you want the controls to just be there, but automatically start the movie without having the end user use the controls, put the following into your button script:
Code: Select all
on mouseUp
set the fileName of player "myPlayer" to "/myvideo.mov"
start player "myPlayer"
end mouseUp
You can also hide the controller from the user with "set the showBadge to false" if you want total control over the player object and not having the end user access to the movie controls. You can use all the other properties and commands of the player object to start, stop and pause the movie playing inside it.
From your last post... do you now want to play one movie, then play another one after it in the same player object?
Thank you for taking time to post,
I tried just about every possible combination to get the video to load then play, apparently there is a problem somewhere, I tested using the script you so very kindly provided and while the file name does change the video does not load to the card.
I thought I had a solution last night, but found that this did not work when build in a standalone.
I guess its back to the drawing board, thanks for your help I appreciate the effort.
In answer to your question, I have seven videos that I want to put into either stacks or into one stack, which ever way I can get it to work. then play the videos separately.
Tim
Posted: Sun Jan 06, 2008 2:23 pm
by BvG
Code of a button:
Code: Select all
on mouseUp
answer folder "folder with movies" --and only movies!
if it <> "" and the result = "" then --chosen folder path is in the var "it"
set the defaultfolder to it
put the files into temp
filter temp without ".*" --to get rid of hidden files
set the moviefiles of player 1 to temp --the moviefiles is a custom property
set the filename of player 1 to line 1 of temp
start player 1
end if
end mouseUp
Code of player 1:
Code: Select all
on playstopped
put the filename of me into lastMovie
set the filename of me to ""
put lineoffset(lastMovie, the moviefiles of me)+1 into nextLineNumber
if nextLineNumber <= the number of lines of the moviefiles of me then
set the filename of me to line nextLineNumber of the moviefiles of me
start me
else --end of list, stop playback
set the paused of me to true
end if
end playstopped
This code works perfectly for me, please look terms up in the docu if you don't know what they do. I used some advanced concepts like the defaultfolder and a custom property, they simplify the code, but are harder to grasp on first encounter, so don't give up easily.
Custom Properties:
they work similar to global variables, but are attached to objects, and thus get saved together with the rest of the stack, also you don't need to declare them.
The defaultFolder:
This works similar to the working directory in a terminal/consol. Rev will look for filenames in the defaultfolder, so if you just specify a filename but no path, that file needs to be within the defaultfolder (most of the time, there are exceptions).
The Files:
a list of all files within the defaultfolder (see also "the folders")
PlayStopped message:
Gets sent when a player stops by itself, or by the "play stop" command.
lineoffset function:
lineoffset let's you find a specific line in a list, i add one to get the next movie to play.
Posted: Sun Jan 06, 2008 2:37 pm
by reelstuff
BvG wrote:Code of a button:
Code: Select all
on mouseUp
answer folder "folder with movies" --and only movies!
if it <> "" and the result = "" then --chosen folder path is in the var "it"
set the defaultfolder to it
put the files into temp
filter temp without ".*" --to get rid of hidden files
set the moviefiles of player 1 to temp --the moviefiles is a custom property
set the filename of player 1 to line 1 of temp
start player 1
end if
end mouseUp
Code of player 1:
Code: Select all
on playstopped
put the filename of me into lastMovie
set the filename of me to ""
put lineoffset(lastMovie, the moviefiles of me)+1 into nextLineNumber
if nextLineNumber <= the number of lines of the moviefiles of me then
set the filename of me to line nextLineNumber of the moviefiles of me
start me
else --end of list, stop playback
set the paused of me to true
end if
end playstopped
This code works perfectly for me, please look terms up in the docu if you don't know what they do. I used some advanced concepts like the defaultfolder and a custom property, they simplify the code, but are harder to grasp on first encounter, so don't give up easily.
Custom Properties:
they work similar to global variables, but are attached to objects, and thus get saved together with the rest of the stack, also you don't need to declare them.
The defaultFolder:
This works similar to the working directory in a terminal/consol. Rev will look for filenames in the defaultfolder, so if you just specify a filename but no path, that file needs to be within the defaultfolder (most of the time, there are exceptions).
The Files:
a list of all files within the defaultfolder (see also "the folders")
PlayStopped message:
Gets sent when a player stops by itself, or by the "play stop" command.
lineoffset function:
lineoffset let's you find a specific line in a list, i add one to get the next movie to play.
Thank you for posting you have given me a lot to think about, It looks like I need to dig a little deeper and examine the process in depth.
I can see from your examples that playing movies using the player object requires thought and some additional reading on my part, thank you for the examples, that explains a lot about what I was missing in trying to put this together,
I appreciate the help.

Posted: Fri Aug 29, 2008 3:56 pm
by kotikoti
Hi reelstuff et all,
Did you manage to get the videoclips (imported) to work in a QT object :- to be able to use the controllers...
I can see this topic has been checked a few times but no solution appears to be in place.
Does RR as a company look at this forum to see items needing clarification/assistance for their users.
Anyone with time to spare and has this sussed out, please share with us on how this is achieved.
As for my setup, I manage to import the video clips to the stack, can play the video files from the "application browser", and can run the clip using script as follows
Code: Select all
on mouseUp
play videoclip "phys_demo1.mov"
end mouseUp
Using a video object, I can't succeed from code as follows to add the file to path...
Code: Select all
on mouseUp
set the fileName of player "myPlayer" to "/phys_demo1.mov"
end mouseUp
What I get when I do that is a blank player item. only sunken border showing...
Please assist...
Koti2
RR version 2.9, Windows Vista Home
Posted: Fri Aug 29, 2008 5:14 pm
by reelstuff
kotikoti wrote:Hi reelstuff et all,
Did you manage to get the videoclips (imported) to work in a QT object :- to be able to use the controllers...
I can see this topic has been checked a few times but no solution appears to be in place.
Does RR as a company look at this forum to see items needing clarification/assistance for their users.
Anyone with time to spare and has this sussed out, please share with us on how this is achieved.
As for my setup, I manage to import the video clips to the stack, can play the video files from the "application browser", and can run the clip using script as follows
Code: Select all
on mouseUp
play videoclip "phys_demo1.mov"
end mouseUp
Using a video object, I can't succeed from code as follows to add the file to path...
Code: Select all
on mouseUp
set the fileName of player "myPlayer" to "/phys_demo1.mov"
end mouseUp
What I get when I do that is a blank player item. only sunken border showing...
Please assist...
Koti2
RR version 2.9, Windows Vista Home
Hi, thanks for posting, I never made any progress with this, instead I used another solution, there may be more options now than before, I hope to someday be able to use FLV video, however that appears to be in the future.
let us know how it goes,
Posted: Sat Aug 30, 2008 3:21 am
by SparkOut
A workaround (however dismal) is not to import the files as videoclips, but just as binfiles, and store them in a custom properties of the stack or card. This will make them portable with the standalone.
Then when you need to play the video clips, you can write them out to specialFolderPath("Temporary") and set the filename to that path/name to play.
Posted: Sat Sep 06, 2008 3:45 am
by kotikoti
Thanks SparkOut, another approach, will give it a try... Haven't used custom properties as yet, will update on findings...