[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2009-05-19
4
Medium Priority
?
1,466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 31

Accepted Solution

by:
Frosty555 earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
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 +…

649 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