Solved

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

Posted on 2009-05-19
4
1,459 Views
Last Modified: 2013-12-07
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
Comment
Question by:MohammadAliQureshi
  • 3
4 Comments
 
LVL 31

Accepted Solution

by:
Frosty555 earned 500 total points
ID: 24428445
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
 

Author Comment

by:MohammadAliQureshi
ID: 24428606
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
 

Author Comment

by:MohammadAliQureshi
ID: 24489284
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
 

Author Closing Comment

by:MohammadAliQureshi
ID: 31583342
Thanks for the help ... Please refer to my last post to see how I implemented thesolution ...

Thanks
<<< Ali >>>
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Internet is a big network which is formed by connecting multiple small networks.It is a platform for all the users which are connected to it.Internet act as platform in different fields. Such as: Internet  as a collaboration platform. Internet  as…
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now