locked
How to play video file inside help chm file? RRS feed

  • Question

  • Hi Folks,

    I have some short video files in wmv format and would like to have it launch inside my tool's help file system (.chm file).

    Is it posible? Any code sample will be much appreciate. These video files show the user how to use my software tool therefore it is very important to have it view inside the chm file.

    thank you in advance.

     

     

    Friday, April 4, 2008 7:49 PM

Answers

  • Hi,

     

    The Helpware site has some useful information on this. See this page:

     

    http://helpware.net/FAR/far_faq.htm#Applets

     

    Pete

    Friday, April 4, 2008 8:17 PM
  • Hi,

     

    This may give you some ideas on how to proceed. Clicking the camcorder image invokes a couple of functions that build a Media Player control on the fly and play a video that is stored in the same directory as the .chm file.

     

    Pete

     

    Code Snippet

    <script type="text/javascript">
    <!--

     

    function GetCurrDir() {

     

      // This function gets the absolute path to the directory that contains
      // the help file. See http://tinyurl.com/yv5xlt for an explanation of
      // what these lines are doing.

     

      var X, Y, sl, a, ra, dir, dir2;

      ra = /::/;
      a = location.href.search(ra);
      if (a <= 0) return("");
      X = 0;
      ra = /:/;
      a = location.href.search(ra);
      if (a == 2) X = 14; else if (a > 2) X = a+1;
      sl = "\\";
      Y = location.href.lastIndexOf(sl);
      dir = location.href.substring(X, Y);
      dir2 = unescape(dir);
      return(dir2 + "\\");

    }

     

    function playVideo(theVideo) {

     

      // Get the absolute path to the current help directory.

     

      var path =  GetCurrDir();

     

      // Make a new Media Player control.

     

      var control = "<object id='mediaPlayer' " +
                    "classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' " +
                    "type='application/x-oleobject'>" +
                    "<param name='fileName' value='"+ path + theVideo + "'>" +
                    "<param name='autoStart' value='true'>" +
                    "<param name='showControls' value='true'>" +
                    "</object>" +
                    "<p><a href='JavaScript:history.back()'>Go back</a></p>";
                
      // Add the new control to the page.

      document.write(control);
     
    }

    //-->
    </script>

     

    <!-- Clicking this image passes the name of the required video file to the playVideo function above. -->

    <a href="JavaScript:playVideo('yourVideo.wmv')"><img src="camcorder.gif"></a>

     

     

     

     

    Pete

    Thursday, April 10, 2008 2:35 PM

All replies

  • Hi,

     

    I'm not sure what a wave video is (I thought wave was just audio.)

     

    But according to this article, you can insert an AVI: http://www.fast-help.com/FAQ.htm#AVIVideo

     

    Please let us know if that works for you.

     

    - Dave

    Friday, April 4, 2008 8:15 PM
  • Hi,

     

    The Helpware site has some useful information on this. See this page:

     

    http://helpware.net/FAR/far_faq.htm#Applets

     

    Pete

    Friday, April 4, 2008 8:17 PM
  •  

    I am thinking more of having a link (picture of the camcorder) and when the user click on the link then the video (.wmv) file is played using window media player (or some other player).

    Anyone?

     

    Wednesday, April 9, 2008 6:24 PM
  • Hi,

     

    This may give you some ideas on how to proceed. Clicking the camcorder image invokes a couple of functions that build a Media Player control on the fly and play a video that is stored in the same directory as the .chm file.

     

    Pete

     

    Code Snippet

    <script type="text/javascript">
    <!--

     

    function GetCurrDir() {

     

      // This function gets the absolute path to the directory that contains
      // the help file. See http://tinyurl.com/yv5xlt for an explanation of
      // what these lines are doing.

     

      var X, Y, sl, a, ra, dir, dir2;

      ra = /::/;
      a = location.href.search(ra);
      if (a <= 0) return("");
      X = 0;
      ra = /:/;
      a = location.href.search(ra);
      if (a == 2) X = 14; else if (a > 2) X = a+1;
      sl = "\\";
      Y = location.href.lastIndexOf(sl);
      dir = location.href.substring(X, Y);
      dir2 = unescape(dir);
      return(dir2 + "\\");

    }

     

    function playVideo(theVideo) {

     

      // Get the absolute path to the current help directory.

     

      var path =  GetCurrDir();

     

      // Make a new Media Player control.

     

      var control = "<object id='mediaPlayer' " +
                    "classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' " +
                    "type='application/x-oleobject'>" +
                    "<param name='fileName' value='"+ path + theVideo + "'>" +
                    "<param name='autoStart' value='true'>" +
                    "<param name='showControls' value='true'>" +
                    "</object>" +
                    "<p><a href='JavaScript:history.back()'>Go back</a></p>";
                
      // Add the new control to the page.

      document.write(control);
     
    }

    //-->
    </script>

     

    <!-- Clicking this image passes the name of the required video file to the playVideo function above. -->

    <a href="JavaScript:playVideo('yourVideo.wmv')"><img src="camcorder.gif"></a>

     

     

     

     

    Pete

    Thursday, April 10, 2008 2:35 PM
  •  

    It worked thank you Pete
    Thursday, April 10, 2008 3:10 PM
  •  

    Just found out that the video only work on my computer but no others computer and i don't know why, can someone

    please help?

    How do i link to the video files inside my help system. I structured the video folder the same way the images file are:

    Here is the structure of the help directory:

    1.html

    2.html

    3.html...

    toc.hhc

    index.hhk

    test.hhp

    images\*.gif files

    videos\*.wmv files

    thank you

    Thursday, May 8, 2008 6:36 PM
  • Hi, dvn,

     

    If you want to store the videos inside your help file then I think the techniques suggested by Alexander Halser in the Helpware article are the easiest to implement.

     

    http://helpware.net/FAR/far_faq.htm#Applets

     

    For example, you might code the link to the video file like this:

     

    <img start="mouseover" loop="1" dynsrc="videos/sample.wmv" />

     

    Here, the video is embedded in the topic pane of the help viewer and starts to play when the user hovers his or her mouse pointer over it.

     

    If you want to play the videos in Window Media Player, or embed the Media Player control in the topic pane, then I think it's necessary to leave the WMV files outside the help file and use scripting to reference them.

     

    Pete

    Sunday, May 11, 2008 2:16 PM
  • Yes i ended up to releasing the videos bundled with .chm file. Thank you for your help.

    Thursday, May 15, 2008 7:27 PM