htmlvideochm

How to include video file into CHM file?


I have CHM file with SWF video inside.

enter image description here

I want to convert it with MP4 and create new CHM file.

Converted, works correctly. But I can't find any program that include video file into CHM like originally. I tried for example HTML Help Workshop. It create a small CHM and make keep video files next to it.

enter image description here

Another program htm2crm do one big file (right). But did incorrect path inside to files (left).

enter image description here

Do you know how to create CHM file with inside video? In order to have one big file.


Solution

  • The short answer is - I am not aware of any application that works with integrated .mp4 videos today.

    After a few current attempts, I can only confirm the statement already made by Tim Green in 2014:

    .. CHM now only permits embedding of SWF video files. All other video file formats must be external to the CHM, otherwise they won't play.

    Please note following hints quoted from About using video files

    Use online video services in CHM. Help+Manual handles this so that the online site is only accessed when the user actually clicks on the preview image to start the video.

    Local video formats will always cause problems in CHM files for at least some of your users and should be avoided.

    Since the termination of Flash support, Microsoft CHM files no longer support embedding for any video formats. MP4 video files can be embedded in Windows eWriter eBooks. All other video files must be distributed with your help as separate files.

    Link for further information:

    For special cases I remember some old stuff to leave the video files outside the help file and use scripting to reference them. Including large video files in your help project could result in an enormous compiled help file. There may also be times when you need to update these files.

    <html>
        <head>
            <title>Example link to video</title>
            <script type="text/javascript">
                <!--
    
    function GetCurrDir() {
    
      // This function gets the absolute path to the directory that contains the help file.
    
      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>
        </head>
        <body>
        <h1>Test case for video</h1>
        <h2>Video 1</h2>
        <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr.</p>
        <!-- Clicking this image passes the name of the required video file to the playVideo function above. -->
        <a href="JavaScript:playVideo('external-files/HTMLHelp-CHM.mp4')"><img src="../images/extlink.gif" /></a>
        </body>
    </html>
    

    See Microsoft Docs Example: Link to a File Outside of Your Help System for an explanation of what these lines are doing.