[SOLVED] how do you play a video?

Started by dogtanian, Wed 24/06/2015 18:52:23

Previous topic - Next topic

dogtanian

Urrghhhh, either my computer is mentally challenged or I am. Okay, first up I think I have put the video file into the right place. I first tried an avi. file which I put into the "compiled" folder and I get a "cannnot find video" message. so I tried converting to ogv. format and I put that file into the Game folder (where the agf. file is) and I get a "cannot load theora video" message.

here is my code (hotspot number 2):

Code: ags

function hHotspot1_Look()
{

    Display("I am about to play sound!");
    AudioChannel* soundChannel = gold1.Play();
    soundChannel.Volume = 100;

}

function hHotspot2_AnyClick()
{
PlayVideo("splash.ogv",eVideoSkipNotAllowed, 0);
}


Have I made a mistake?

Khris

I opened my default game, added the line you have in a hotspot's LookAt event and pressed F5.
In game, I got the message, "unable to load theora video 'splash.ogv'"

I closed the game and copied a video into the game folder, renaming it to "splash.ogv".
Back in AGS I pressed F5, looked at the hotspot and BAM, video. It even works when I rename it to "Splash.ogv", so capitalization doesn't seem to matter.

Again, not sure why this isn't working for you. However, since the error is worded differently, maybe the file isn't a proper ogv?
Because "cannot load", as opposed to "unable to load", might refer to AGS having trouble reading the file contents.
Could you try another ogv?

dogtanian

Thankyou Khris. :)

The video plays in VLC Player but you might be right, I don't know for certain if the video converted properly to OGV format. I converted from a YouTube FLV video to OGV using Any Video Converter, it could be a bad conversion so I'll try an OGV that definitely works and come back here later.

Btw, the actual error message was Unable to load theora video 'splash.ogv'


Crimson Wizard

I used this Theora video to test this functionality: https://commons.wikimedia.org/wiki/File:Examplevideo.ogv (successful in 3.2.1 to 3.4.0)

Khris

I tried something else and took a random text file, copied it over "splash.ogv" and ran the game again. That resulted in a pretty nasty crash, which probably means that in your case AGS actually can't find the file.

I assume you use Windows Explorer? (I use TotalCommander, which I dearly recommend to anyone who occasionally does stuff that involves files)
Can you make sure the file is actually called "splash.ogv", and not "splash.ogv.avi" or something like that?
Because Windows likes to hide known file extensions unless you disable that in the folder options.
And it would explain why VLC plays it but AGS can't find it.

dogtanian

Quote from: Khris on Thu 25/06/2015 16:53:13
I tried something else and took a random text file, copied it over "splash.ogv" and ran the game again. That resulted in a pretty nasty crash, which probably means that in your case AGS actually can't find the file.

I assume you use Windows Explorer? (I use TotalCommander, which I dearly recommend to anyone who occasionally does stuff that involves files)
Can you make sure the file is actually called "splash.ogv", and not "splash.ogv.avi" or something like that?
Because Windows likes to hide known file extensions unless you disable that in the folder options.
And it would explain why VLC plays it but AGS can't find it.

Bam! Right on the head without even looking. (laugh)
Well done Khris, yep that was the culprit.

Also a thankyou to CW, that ogv sample video helped too.

SMF spam blocked by CleanTalk