home *** CD-ROM | disk | FTP | other *** search
/ ftp.novell.com / 2014.06.ftp.novell.com.tar / ftp.novell.com / forge / camtasia.msi / Cabs.w1.cab / WMVAdditionalembed.js2270 < prev    next >
Text File  |  2009-08-17  |  4KB  |  84 lines

  1.    function SwitchPlayer( elementId, styleId, VideoFileName, VideoWidth, VideoHeight, MediaDirectory, MediaDirectoryNotEscaped, ObjectIDName, ObjectType, ObjectClassID, ObjectCodebase, ObjectStandBy, EmbedName, ParamLoop, ParamAutoStart, ParamUiMode, toc1, toc2 )
  2.    {        
  3.       var n = (typeof elementId == 'string') ? document.getElementById( elementId ) : elementId;
  4.       n.innerHTML = getWMVHTML( styleId, VideoFileName, VideoWidth, VideoHeight, MediaDirectory, MediaDirectoryNotEscaped, ObjectIDName, ObjectType, ObjectClassID, ObjectCodebase, ObjectStandBy, EmbedName, ParamLoop, ParamAutoStart, ParamUiMode, toc1, toc2 );
  5.       return true;
  6.    }  
  7.    
  8.    function getWMVHTML( divId, VideoFileName, VideoWidth, VideoHeight, MediaDirectory, MediaDirectoryNotEscaped, ObjectIDName, ObjectType, ObjectClassID, ObjectCodebase, ObjectStandBy, EmbedName, ParamLoop, ParamAutoStart, ParamUiMode, toc1, toc2 ) 
  9.    {
  10.       if ( toc1 == undefined || toc1 == null )
  11.         {
  12.             toc1 = "";
  13.         }
  14.         
  15.         if ( toc2 == undefined || toc2 == null )
  16.         {
  17.            toc2 = "";    
  18.         }
  19.         
  20.       var node = "";
  21.  
  22.       var videosubdirectory = MediaDirectoryNotEscaped;
  23.       var videofile = VideoFileName;
  24.       //this will be the final video link (absolute path)
  25.       var videolink = location.href;
  26.  
  27.       //remove the file:// because windows media doesn't understand that
  28.       var file = videolink.indexOf( "file://");
  29.  
  30.       if ( file > -1 )
  31.       {
  32.          // THIS IS A LOCAL PATH
  33.          videolink = videolink.substring( file + 8 );
  34.  
  35.          //remove the %20 because media player doesn't understand those
  36.          while( videolink.lastIndexOf( "%20" ) != -1 )
  37.          {
  38.             videolink = videolink.replace( "%20", " " );
  39.          }
  40.  
  41.          //remove the html file name now
  42.          var lastslash = videolink.lastIndexOf( "/");
  43.  
  44.          if ( lastslash > -1 )
  45.             videolink = videolink.substring( 0, lastslash );
  46.  
  47.          //add the subfolder (if there is one) and then the video file name
  48.          if ( videosubdirectory.length > 0 )
  49.             videolink = videolink + "/" + videosubdirectory + videofile;
  50.          else
  51.             videolink = videolink + "/" + videofile;
  52.       }
  53.       else
  54.       {
  55.          if ( videosubdirectory.length > 0 )
  56.             videolink = videosubdirectory + videofile;
  57.          else
  58.             videolink = videofile;
  59.       }
  60.             
  61.       node = '<div id="' + divId + '">' 
  62.            + toc1
  63.            + '   <object id="' + ObjectIDName + '" classid="' + ObjectClassID + '"'
  64.            + '   width="' + VideoWidth + '" height="' + VideoHeight + '"'
  65.            + '   codebase="' + ObjectCodebase + '"'
  66.            + '   standby="' + ObjectStandBy + '"'
  67.            + '   type="' + ObjectType + '">'
  68.            + '      <param name="autoStart" value="' + ParamAutoStart + '"/>'
  69.            + '      <param name="url"       value="' + MediaDirectory + VideoFileName + '" />'
  70.            + '      <param name="wmode"     value="transparent" />'
  71.            + '      <param name="uiMode"    value="' + ParamUiMode + '" />'
  72.            + '      <param name="loop"      value="' + ParamLoop + '" />'               
  73.            + '      <embed id       ="' + EmbedName + '"'
  74.            + '          type        ="application/x-mplayer2"'
  75.            + '          src         ="' + videolink + '"'
  76.            + '          width       ="' + VideoWidth + '"'
  77.            + '          height      ="' + VideoHeight + '">'
  78.            + '      </embed>'
  79.            + '   </object>'
  80.            + toc2
  81.            + '</div>';
  82.  
  83.       return node;
  84.    }