Solved

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

Posted on 2009-05-19
4
1,460 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

939 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

4 Experts available now in Live!

Get 1:1 Help Now