Play Video
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Play Video
I am trying to get videos to play appropriately un Windows. For background, this is a free app that will be given to children and adults with disabilities, who need to either learn how to use adapted interfaces to a computer, or just develop basic interface operational competency. So, I need to be able to set this up with a caregiver, and it just works.
The videos are MP4 files. They will play in Windows 10 using the MPC-HC or Movies & TV player.So I am guessing this is a path issue.
The video files are in the folder "VideoFolder". In the stand alone settings, I have enabled "Copy Referenced Files" and named the Destination Folder "resources". This folder is created in the Mac build but not Windows. This works perfectly on Mac, but not Windows:
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put "VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
This also doesn't work in Windows:
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put specialFolderPath("resources") & "/VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
This is a card script:
global gActivity
on preOpenCard
put "BarnChatter" into gActivity
loadVideo
if there is a player "movie" then set the currentTime of player "movie" to 0
end preOpenCard
on openCard
start player "movie"
end openCard
on playStopped
wait 60 with messages --this is for users to cognitively process the end of the movie
unmark this card
visual effect "push down" to card
go to card "aac_Choice_cd"
end playStopped
on closeCard
if there is a player "movie" then stop player "movie"
end closeCard
--on loadVideo pVidName
-- put "BarnChatter_1.mp4" into pVidName
-- put specialFolderPath("resources") & "/VideoFolder/" & pVidName into tPath
-- set the filename of player "movie" to tPath
--end loadVideo
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put "VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
I have promised this to a parent by Thanksgiving. Can anyone please point me in the correct direction? Should I convert the videos to MPEG? I have read that this seems to work better in Windows.
Thanks in advance!
The videos are MP4 files. They will play in Windows 10 using the MPC-HC or Movies & TV player.So I am guessing this is a path issue.
The video files are in the folder "VideoFolder". In the stand alone settings, I have enabled "Copy Referenced Files" and named the Destination Folder "resources". This folder is created in the Mac build but not Windows. This works perfectly on Mac, but not Windows:
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put "VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
This also doesn't work in Windows:
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put specialFolderPath("resources") & "/VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
This is a card script:
global gActivity
on preOpenCard
put "BarnChatter" into gActivity
loadVideo
if there is a player "movie" then set the currentTime of player "movie" to 0
end preOpenCard
on openCard
start player "movie"
end openCard
on playStopped
wait 60 with messages --this is for users to cognitively process the end of the movie
unmark this card
visual effect "push down" to card
go to card "aac_Choice_cd"
end playStopped
on closeCard
if there is a player "movie" then stop player "movie"
end closeCard
--on loadVideo pVidName
-- put "BarnChatter_1.mp4" into pVidName
-- put specialFolderPath("resources") & "/VideoFolder/" & pVidName into tPath
-- set the filename of player "movie" to tPath
--end loadVideo
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put "VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
I have promised this to a parent by Thanksgiving. Can anyone please point me in the correct direction? Should I convert the videos to MPEG? I have read that this seems to work better in Windows.
Thanks in advance!
Re: Play Video
I haven't really looked through Windows with any vigor in many years, but I suspect this is a codecs issue. I would try to figure out the video formats that Windows is definitely going to be able to play, like .avi for instance, then cross reference to what Lc is set to play, although, I believe now Lc uses Windows media player (or its equivalent), so it should be anything media player is set to play by default.
Of course, I don't do much with videos either
so I could be way off.
Of course, I don't do much with videos either
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
![Image](https://s7.postimg.cc/v87si6xuj/Forum_Signature.png)
Re: Play Video
The .avi format literally triples the movie size - there are 45 movies total. The MP4's are playing using Windows players. I also installed K-Lite_Codec_Pack. These will mostly be played on low power tablet style computer systems, so I am really trying to keep the size as small as possible.
Re: Play Video
If LC can play a MP4 movie in a player object, then it is not a codec issue. Did you try that?
Most of the time this is a pathname issue.
I haven't beeen using Windows for a long time, and never used the checkbox "Copy referenced files", so what does the folder structure of your Win standalone looks like in the end?
Are you sure the video gets copied to the standalone? That namely checkbox only affects images and player objects that already have a filename during development.
Most of the time this is a pathname issue.
I haven't beeen using Windows for a long time, and never used the checkbox "Copy referenced files", so what does the folder structure of your Win standalone looks like in the end?
Are you sure the video gets copied to the standalone? That namely checkbox only affects images and player objects that already have a filename during development.
Re: Play Video
If LC can play a MP4 movie in a player object, then it is not a codec issue. Did you try that?
Most of the time this is a pathname issue.
I don't think it is a codec issue. The MP4 files play fine in Windows 10 using the MPC-HC or Movies & TV player.
I haven't beeen using Windows for a long time, and never used the checkbox "Copy referenced files", so what does the folder structure of your Win standalone looks like in the end?
Test Build > Cause2Effect >
Externals (contains tsNet file)
VideoFolder (Contains all the video files)
Cause2Effect.exe
I have also added the folder "VideoFolder" to the Copy Files pane.
Most of the time this is a pathname issue.
I don't think it is a codec issue. The MP4 files play fine in Windows 10 using the MPC-HC or Movies & TV player.
I haven't beeen using Windows for a long time, and never used the checkbox "Copy referenced files", so what does the folder structure of your Win standalone looks like in the end?
Test Build > Cause2Effect >
Externals (contains tsNet file)
VideoFolder (Contains all the video files)
Cause2Effect.exe
I have also added the folder "VideoFolder" to the Copy Files pane.
Re: Play Video
Please try my advice!
LC is using an older API for multimedia stuff on Window, so if a file plays fine in WMP or any other Windows-native videoplayer does not mean it will work inside of LC!
And please check -> the result right after setting the filename:
Code: Select all
...
put "BarnChatter_1.mp4" into pVidName
put "VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
if the result <> EMPTY then
answer the result
end if
...
Re: Play Video
LC players on Windows use the VFW api. This does not have the same codecs autobundled that other players have. The K-Lite codec pack normally sorts out the issue.
Do the players load content but play only sound with a black or striped background?
If so, it is still a codec thing. Try reinstalling the codec pack and rebooting if that is the case.
If you renamed the destination folder "resources" under the copy files pane, then you probably have another folder called resources nested inside the resources folder. Check the paths. In your script try "if there is a file..." to see if the video you want can be found. It could be the nested folder, or a wrong name, or a filename/path with special characters, or a problem with the folder location relative to the executable.
Hopefully you can get to the bottom of this. I use mp4 videos on Windows (using the K-Lite codecs) so it can be done.
[Edit... outklaussed again!]
Do the players load content but play only sound with a black or striped background?
If so, it is still a codec thing. Try reinstalling the codec pack and rebooting if that is the case.
If you renamed the destination folder "resources" under the copy files pane, then you probably have another folder called resources nested inside the resources folder. Check the paths. In your script try "if there is a file..." to see if the video you want can be found. It could be the nested folder, or a wrong name, or a filename/path with special characters, or a problem with the folder location relative to the executable.
Hopefully you can get to the bottom of this. I use mp4 videos on Windows (using the K-Lite codecs) so it can be done.
[Edit... outklaussed again!]
Re: Play Video
I'm sorry, I must not have been clear enough in my previous post. I wasn't suggesting you use the .avi format, it was merely an example of what I *know* windows has, that Lc will "play". As I said, I haven't touched a windows machine in any serious way in a long time, and can't remember off the top of my head the common formats to both Windows and Lc.
Sorry for any confusion, looks like Klaus and SparkOut have you going the right way though.
![Image](https://s7.postimg.cc/v87si6xuj/Forum_Signature.png)
Re: Play Video
@Klaus - Sorry I misread your advice. The result is VideoFolder/BarnChatter_1.mp4
@SparkOut - In Livecode, it only plays the sound, the card is white. I didn't rename the destination folder "resources" under the copy files pane. That is "VideoFolder". In "Copy Referenced Files" I did name the Destination Folder "resources". In the Mac, this creates a folder "resources" as part of the package, so the app can be distributed without dependencies. I renamed it specifically to test the Windows side, and it is not being created. That's why this works in Mac and not Windows:
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put specialFolderPath("resources") & "/VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
I am going to try MPEG format. I am still open to and appreciate any and all suggestions.
@bogs - Thanks!
@SparkOut - In Livecode, it only plays the sound, the card is white. I didn't rename the destination folder "resources" under the copy files pane. That is "VideoFolder". In "Copy Referenced Files" I did name the Destination Folder "resources". In the Mac, this creates a folder "resources" as part of the package, so the app can be distributed without dependencies. I renamed it specifically to test the Windows side, and it is not being created. That's why this works in Mac and not Windows:
on loadVideo pVidName
put "BarnChatter_1.mp4" into pVidName
put specialFolderPath("resources") & "/VideoFolder/" & pVidName into tPath
set the filename of player "movie" to tPath
end loadVideo
I am going to try MPEG format. I am still open to and appreciate any and all suggestions.
@bogs - Thanks!
Re: Play Video
My advice was to play your MP4 in a player object in another stack, just to test if the codec works!
And the result is EMPTY if setting the filename (via script) was successfull!
If the video was not found, it will read: could not create movie reference
Just tested here.
So please check everything again.
And the result is EMPTY if setting the filename (via script) was successfull!
If the video was not found, it will read: could not create movie reference
Just tested here.
So please check everything again.
Re: Play Video
If it plays the sound but not video, that to me is a sign of a codec problem. If you reinstall the codec pack and REBOOT the computer, does it play then?
If not, is it possible to upload a sample video that I can test here and check whether it's just your environment or if there is something about it that means it won't play at all?
If not, is it possible to upload a sample video that I can test here and check whether it's just your environment or if there is something about it that means it won't play at all?
Re: Play Video
Made a test on Windows 10 (on my Mac with Paralells) and everything worked as exspected.
I created a stack with one EMPTY player object and one button.
Buttons script:
Then I created a standalone for Mac and Windows.
Works on Mac and also fine on Windows, video is found and plays.
I also had installed an extra codec package some time ago.
See attached screenshot of the folder structure on Windows.
I created a stack with one EMPTY player object and one button.
Buttons script:
Code: Select all
on mouseUp
set the filename of player 1 to (specialfolderpath("resources") & "/testvideo.mp4")
end mouseUp
Works on Mac and also fine on Windows, video is found and plays.
I also had installed an extra codec package some time ago.
See attached screenshot of the folder structure on Windows.
Re: Play Video
Just repeated the test, but put the video into a folder named "VideoFolder", changed the buttons script to:
And it also worked as advertized.
Code: Select all
on mouseUp
set the filename of player 1 to (specialfolderpath("resources") & "/VideoFolder/testvideo.mp4")
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Play Video
Now try that on Linux.Klaus wrote: ↑Wed Nov 21, 2018 12:16 pmJust repeated the test, but put the video into a folder named "VideoFolder", changed the buttons script to:And it also worked as advertized.Code: Select all
on mouseUp set the filename of player 1 to (specialfolderpath("resources") & "/VideoFolder/testvideo.mp4") end mouseUp
![Wink ;)](./images/smilies/icon_wink.gif)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Play Video
It sounds like two problems. I can't help much with the codec issue. For the file path, don't create any folder named Resources, the standalone builder does that automatically for you.
Drag the VideoFolder to the Copy Files pane of the standalone settings. Turn off the checkbox, you don't need it because you're creating your own file paths in script.
The path to the videos on either platform will be:
specialfolderpath("resources") & "/VideoFolder/<video name>")
This is also the path during development, since specialFolderPath("resources") points to the folder containing the mainstack in the IDE.
Drag the VideoFolder to the Copy Files pane of the standalone settings. Turn off the checkbox, you don't need it because you're creating your own file paths in script.
The path to the videos on either platform will be:
specialfolderpath("resources") & "/VideoFolder/<video name>")
This is also the path during development, since specialFolderPath("resources") points to the folder containing the mainstack in the IDE.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com