[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1467
  • Last Modified:

How Do I embed wmv files that works on all browsers ...

Hello:

I would like to embed a wmv file into html code. My problem is that it works fine in IE but not in other brosers (FF, Safari). For FF and Safari, the window is basically blank ...

Attached is the js script I am using ...

P.S. This attached code is a modified version of the code that I found that will embed audio. However, I needed video, so I modified it. The original script (For Audio) is @
// Pop-Up Embedder Script by David Battino, www.batmosphere.com
// Version 2006-05-31  

function MyVideoPop(filedesc,filepath,WindowNumber) 
{
 
// Get Operating System 
var isWin = navigator.userAgent.toLowerCase().indexOf("windows") != -1
if (isWin) {
    // Use MIME type = "application/x-mplayer2";
	visitorOS="Windows";
} else {
    // Use MIME type = "audio/mpeg"; // or audio/x-wav or audio/x-ms-wma, etc.
	visitorOS="Other";
}
 
// Get the MIME type of the audio file from its extension (for non-Windows browsers)
var class_id = "CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95";
var ttype = "video/x-ms-wmv";
var ttype2 = "application/x-oleobject";
var codebase = "codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112'";
 
  if (visitorOS != "Windows")
  { 
    class_id = ""; 	
  }
    PlayerWin = window.open('',WindowNumber,'width=675,height=675,top=0,left=0,screenX=0,screenY=0,resizable=1,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=1,directories=0');
 
    PlayerWin.focus();
    PlayerWin.document.writeln("<html><head><title>" + filedesc + "</title></head>");
    PlayerWin.document.writeln("<body bgcolor='#CEE1F7'>"); // specify background img if desired
    PlayerWin.document.writeln("<div align='center'>");
    PlayerWin.document.writeln("<p style ='color:green;font-size:20px;font-family:Lucida,sans-serif;'>" + filedesc + "</p><br />");
    
    if (visitorOS == "Windows")
     {
      PlayerWin.document.write("<object type='video/x-ms-wmv' classid='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95' ");
     }
    else
     {
      PlayerWin.document.write("<object data='" + filepath + "' ");     
     }
    PlayerWin.document.writeln(" standby='Loading Windows Media Component, Please wait ... ' height='500' width='500'>"); 
//    PlayerWin.document.writeln("<object ID='MediaPlayer' width='500' height='500' " + 
//                               "CLASSID='" + class_id + "'" + 
//                              " standby='Loading Windows Media Player Components...'" +
//                             " type='" + ttype + "'" +
//                               ">");
    PlayerWin.document.writeln("<param name='src' value='" +  filepath + "'>");
    PlayerWin.document.writeln("<param name='autostart' value='1'>");
    PlayerWin.document.writeln("<param name='showcontrols' value='1'>"); 
    PlayerWin.document.writeln("<param name='showstatusbar' value='1'>");
    PlayerWin.document.writeln("<param name='animationatStart' value='1'>");
    PlayerWin.document.writeln("<param name='transparentatStart' value='1'>");
    PlayerWin.document.writeln("<embed src ='" + filepath + " type='application/x-mplayer2'" + " autoplay='true'  height = '600' width = '600' controller='1' showstatusbar='1' bgcolor='#9999ff' kioskmode='true'>");
    PlayerWin.document.writeln("</embed></object></div>");
 //   PlayerWin.document.writeln("<p style='font-size:12px;font-family:Lucida,sans-serif;text-align:center'><a href='" + filepath +"'>Download this file</a> <span style='font-size:10px'>(right-click or Control-click)</span></p>");
    PlayerWin.document.writeln("<p style='color:green;font-size:20px;font-family:Lucida,sans-serif;text-align:center'>Double Click The Image To Make It Full Screen</p>");
    PlayerWin.document.writeln("<form><div align='center'><input type='button' value='Close this window' onclick='javascript:window.close();'></div></form>");
    PlayerWin.document.writeln("</body></html>");
 
    PlayerWin.document.close(); // "Finalizes" new window
}

Open in new window

0
MohammadAliQureshi
Asked:
MohammadAliQureshi
  • 3
1 Solution
 
Frosty555Commented:
There's a good discussion on this here:
http://forums.techguy.org/web-design-development/425529-embedded-wmv-video-not-working.html

Make sure your code conforms to the standard shown in that thread.

Also, make sure you have an appropriate plug in for playing WMV files in firefox. Otherwise nothing will work no matter what HTML you put in. More on that here:

http://forums.mozillazine.org/viewtopic.php?t=206213
0
 
MohammadAliQureshiAuthor Commented:
Hello Frosty555:

I did visit http://forums.techguy.org/web-design-development/425529-embedded-wmv-video-not-working.html.

Is the code in the website HTML?

My code snippet is my attempt to implement what his website has in javascript.

I am still reading the info in the other website you mentioned (foruns.mozillazine). So far, it looks like that my FF should dipaly the wmv correctly. I will keep you uptodate ..

Thanks,

<< Ali >>>
0
 
MohammadAliQureshiAuthor Commented:
Hello:
Just to inform how did I solve the embed problem ...

I called a Javascript function to open a new window - I learned from  Pop-Up Embedder Script by David Battino, www.batmosphere.com Version 2006-05-31 -
with html code mentioned in the following link provided by Frosty555 (Thanks). Now it works in all three browsers (IE, Safari and FireFox) - I did not try it on Mac!!).

Thanks,
<<< Ali >>>
0
 
MohammadAliQureshiAuthor Commented:
Thanks for the help ... Please refer to my last post to see how I implemented thesolution ...

Thanks
<<< Ali >>>
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now