Game Development Community

Sound plays, but no video?

by Mike Rowley · in Torque Game Engine · 02/14/2007 (8:02 pm) · 4 replies

I have switched gears and chosen to use things already in the engine. I'm using a theoraVideoGui control.
Here's what I have:

my tribute.gui:
new GameTSCtrl(myVideoGui) {
   canSaveDynamicFields = "0";
   Profile = "GuiContentProfile";
   HorizSizing = "right";
   VertSizing = "bottom";
   position = "0 0";
   Extent = "640 480";
   MinExtent = "8 8";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";
   applyFilterToChildren = "1";
   cameraZRot = "0";
   forceFOV = "0";

   new GuiTheoraCtrl(tributeVideo) {
      canSaveDynamicFields = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "114 50";
      Extent = "376 306";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "0";
      hovertime = "1000";
      done = "0";
      stopOnSleep = "0";
      backgroundColor = "0 0 0 255";
   };
};

my videoTrigger.cs to get the video playing and set the gui visible:
function VideoTrigger::onEnterTrigger(%this,%trigger,%obj)
{
      Parent::onEnterTrigger(%this,%trigger,%obj);

   PlayVideoFile();
}

function VideoTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
      Parent::onLeaveTrigger(%this,%trigger,%obj);

      StopVideoFile();
}

   function PlayVideoFile()
{
%filename = "wtc/data/vid/911tribute.ogg";
tributeVideo.setFile(%filename);
tributeVideo.setVisible="true";

echo("Entered Video Area");
}
function StopVideoFile()
{
tributeVideo.stop();
tributeVideo.setVisible="false";
echo("Left Video Area");
}

The console log:
TheoraTexture - Loading file 'wtc/data/vid/911tribute.ogg'
   Ogg logical stream 5e4b is Theora 320x240 25.00 fps video
      - Frame content is 320x240 with offset (0,0).
   Ogg logical stream 622b is Vorbis 2 channel 44100 Hz audio.
Entered Video Area

The only error:

MagicalTrevor::advancetime - no last occurrence for buffer -1 found!

What I have done is to make a gui where I want it to play, set it by default as invisible. In my PlayVideoFile() command, I set the gui as visible. (am I doing this right??)
I placed my trigger in the building where the movie is to play, and it works as can be seen by the console log.
Now, when I enter the trigger, I get sound, but no video. Any clue what I am doing wrong?

#1
02/14/2007 (8:09 pm)
Wrong syntax on the setVisible cmd.

It should be:
tributeVideo.setVisible(true);
#2
02/14/2007 (8:18 pm)
Thanks Tim,
That got rid of the one error message, but I still have sound and no video. If I set the gui as visible in it's datablock, It works, but then I have a black screen in front of my face until I walk into the trigger zone.
I'm learning slowly.
#3
02/14/2007 (8:29 pm)
Are you saying that the video plays fine when set to play in the GUI editor but not when using your code?

Also, just noticed something disturbing... Why on earth are you using a GameTSCtrl for the video GUI?

Eg
new GameTSCtrl(myVideoGui) {

Try using a normal GuiControl:

Eg
new GuiControl(myVideoGui) {
   Profile = "GuiDefaultProfile";
   HorizSizing = "right";
   VertSizing = "bottom";
   position = "0 0";
   Extent = "640 480";
   MinExtent = "8 2";
   Visible = "1";

   new GuiTheoraCtrl(tributeVideo) {
      canSaveDynamicFields = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "114 50";
      Extent = "376 306";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      done = "0";
      stopOnSleep = "0";
      backgroundColor = "0 0 0 255";
   };
};

Lastly, is the GUI you created for the video part of playGui.gui or is it in a separate new file? If the latter, you'll need to use:
canvas.pushDialog(myVideoGui); // show video
   canvas.popDialog(myVideoGui);  // hide video

Use those cmds in place of setVisible(); - make sure the GUI is saved as visible though
#4
02/15/2007 (2:44 am)
Quote:Why on earth are you using a GameTSCtrl for the video GUI?
Becouse originally, torque saved it as "PlayGUI" and I removed all the extra stuff becouse I didn't need it.

Quote:Lastly, is the GUI you created for the video part of playGui.gui or is it in a separate new file? If the latter, you'll need to use:

I saved it as a standalone script. I figured that would make it easier to work with. :D

Thankyou for your help. My movie now plays when it's supposed to. still gripping to watch tho.
Now, to go find a convertor that won't add a stupid add in the center of the screen..I have one somewhere.

Thanks for all your help. It was much appreciated, and I have learned a lot from this one world. :)
Mike