Page 1 of 1

LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 2:12 pm
by joran
Hi I just wondered, since i have been going through a LiveCode Lesson about how to create a VideoLibrary and from the standalone version play those videos included in a videofolder
next to the application file.

I think I have done everything by the book, The Video player works fine in "run" mode inside LC, but when I create the standalone version, it does not load the files.
The application does however show the names of the files, but do not load them into the player.

Anyone out there who could possibly be of assistance ?

// Joran

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 2:35 pm
by joran
Here is the specific link to the lesson i am referring to

http://lessons.livecode.com/m/754

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 6:36 pm
by Klaus
Hi Joran,

1. are you on a Mac or Windows?
2. What version of Livecode are you using?
3. Did you add the folder with the video file(s) to your standalone
via the "Copy files" tab in the standalone builder settings?


Best

Klaus

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 7:32 pm
by joran
hi, sorry not to inform you about my basic setup, it is;

Macbook pro, OS X 10.11.06 El Capitain
LC ver. 8.1.2

3. Yes I tried that, but also as the Lesson I referred to said .livecode file next to a folder called "Videos" (including 2 video files)

In LC run mode, it works, the files are loaded and played

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 7:50 pm
by Klaus
Hi joran,

okie dokie! :D

Yes, on the Mac the pathnames are different in a standalone than in the IDE or in a Windows standalone.
You said YES to 3. so you will find your videos (folder with the videos) in:
specialfolderpath("resources")

So you will need to change your uiLoadSelectedVideo Handler to this:

Code: Select all

on uiLoadSelectedVideo
   put the selectedtext of fld "Video Menu" into theVideoName

   ## Create correct pathname to video:
   put specialfolderpath("resources") & "/Videos/" & theVideoName into tVideoFile
   set the filename of player "My video" to tVideoFile
   set the currenttime of player "My video" to 0
end uiLoadSelectedVideo
This will also work in the IDE since in the IDE specialfolderpath("resources") will point to the folder
where the stack lies which is executing this script!

Check by yourself, enter this into the message box in the IDE:
put specialfolderpath("resources")


Best

Klaus

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 8:24 pm
by joran
Here is the uiLoadSelectedVideo - in my card script

//
command uiLoadSelectedVideo
## Get the name of the video selected in the video menu
put the selectedtext of field "Video Menu" into theVideoName
put "Videos/" & theVideoName into theVideoFile

## Set 'the filename' property the player object to the relative video path
## Revolution will locate the video as long as the "Videos" folder is
## alongside the stack file or the application executable.
set the filename of player "My Video" to theVideoFile

## Reset the time of the Player object to 0
set the currenttime of player "My Video" to 0
end uiLoadSelectedVideo

//
Am I supposed to change the totality of the command or what ?

I been away from LC for a while, so bear with me and big thank“s for helping . . .

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 9:05 pm
by joran
Hi agan

Pasted your code just under - on preOpenCard
and did a new try to save as standalone application - and yes it works !

But only if I place the resource folder "Videos" besides the standalone file.

Im not able to load the video files from the standalone application being on its own so to say.
I have added 2 video files i the "Copy files" section in - set standalone application

Any clues ?

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 9:05 pm
by Klaus
joran wrote:Am I supposed to change the totality of the command or what ?
What part of
So you will need to change your uiLoadSelectedVideo Handler to this:
... complete and corrected handler "uiLoadSelectedVideo ...
didn't you understand?
Maybe you can spot the difference to your original script?

Re: LiveCode Lessons - Playing from a Video Library

Posted: Mon Jan 16, 2017 9:28 pm
by Klaus
joran wrote:...
But only if I place the resource folder "Videos" besides the standalone file.

Im not able to load the video files from the standalone application being on its own so to say.
I have added 2 video files i the "Copy files" section in - set standalone application
Did you
a. add the two video files as separate files (means NOT in a folder) or did you
b. add the complete folder "Videos"with the two videos inside?

If a. then you need to
...
put specialfolderpath("resources") & "/" & theVideoName into tVideoFile
...
If b. then:
...
put specialfolderpath("resources") & "/Videos/" & theVideoName into tVideoFile
...

Re: LiveCode Lessons - Playing from a Video Library

Posted: Tue Jan 17, 2017 12:53 pm
by joran
ok, thank you, i will try that . . . have to let this sink in though, as I said earlier I'v been away from LC awhile and see that I have to do some serious study.
But its fun ... :-)