Page 1 of 1

Load Video from HD (solved)

Posted: Fri Jul 06, 2018 1:31 pm
by Xero
Hi,
Another stupid question!
I am rounding out a video analysis app, and just need to know the command that will allow a user to load a video from anywhere on a HD. Something like this:

Click on button, open up dialogue box that shows C:/ (or whatever),
Find a video, select it, get that path, use that path as the path of the video in player on screen.

Just like you would with any program or app.
Can't seem to find a way of doing it. Have done the Video Library tutorial, but that seems like a silly way of doing it: forcing a user to put accessible videos in one certain folder relative to standalone. Who would do that???
Looked through dictionary, but problem is... if you don't know what command to use, you can't find the command to use!

Thanks in advance.

(I have almost done this app... and I promise I will share the source here when done, as it covers using vector graphics, loading videos, playing videos and all the normal functions that go along with it. I even solved the problem of having to create rectangles in a certain order (i.e. top left to bottom right) that can be used in vector graphic drawing apps)

Re: Load Video from HD

Posted: Fri Jul 06, 2018 2:00 pm
by bogs
You may want to look into 'answerFile' {with type} in the dictionary, as that is how you'd build a typical file dialog.

From Brian's version of the dictionary here, where I typed "answer" into the search -

Code: Select all

answer files "Select the files you wish to process:"
if the result is not "Cancel" then
   put it into tChosenFiles
....
You might also try looking through Max's wiki, but generally all the information you might need should be readily available right there.

Re: Load Video from HD

Posted: Fri Jul 06, 2018 2:08 pm
by Klaus
Hi Xero,

you need to unse -> answer file...

Code: Select all

...
## Will only show MP4 files in the dialog.
## You can supply a comma separated list of suffixes you want to allow resp. LC can play -> mp4,avi,mkv,mov...
answer file "Please select a video:" with type "Videos|mp4|"
put it into tVideoFile

## User clicked CANCEL:
if tVideoFile = EMPTY then
 exit to top
end if

## Now do something with the full path to the video in tVideoFile
set the filename of player "your player object here..." to tVideoFile
...
Best

Klaus

P.S.
May I ask a personal question? Xero is your name, right?
This is not really a common name, I only know a (deceased) english saxophone player with that name: Xero Slingsby (and the Works), heavy stuff :-)
https://www.youtube.com/watch?v=2_1tby7 ... gs=pl%2Cwn

Re: Load Video from HD

Posted: Fri Jul 06, 2018 2:27 pm
by Xero
Thanks Klaus,
Yet again you're a font of all knowledge!
That should be part of a tutorial... I would have thought that would be common to need to do, but not obvious when it comes to the script.
As for my name... Xero is a pen name from the mid 90's when I was writing webpages in GeoCities (anyone remember that???). Not my real name, just one I use a lot!
XdM

Re: Load Video from HD (solved)

Posted: Fri Jul 06, 2018 3:49 pm
by Klaus
Glad I could help, but bogs was actually faster (THIS time)! :D

And thank you for the info about your name.

Re: Load Video from HD (solved)

Posted: Fri Jul 06, 2018 8:17 pm
by bogs
See what happens when you explode neutron stars? :D

Re: Load Video from HD (solved)

Posted: Fri Jul 06, 2018 8:45 pm
by Klaus
Yes, sure, mumble, mumble, muble...

Like, y'know, so many girls erm... stars, so little time. :?