473,394 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

switching an Iframe media player with plugin decection

riptide2049
I really have a problem here. I have a code that is suppost to take the href of a link from the right class;value of a link maked toreturn false. the value is a Media file the file is sent to quicktime or windows meida player depending on which plugin was found. after the plug in is found a iframe with the right player is created.


here is the code. for some reason In IE the plug in doesnt work and in fire fox it crashes

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. <script language="javascript"  type="text/javascript">
  7.  
  8.  
  9. /*if you have windows media player*/
  10. function WMPFrame() { 
  11. var iframe = document.createElement("iframe"); 
  12. iframe.setAttribute("src", "WMPIframe.html"); 
  13. iframe.setAttribute("id", "playerframe"); 
  14. iframe.setAttribute("scrolling", "no"); 
  15. iframe.setAttribute("frameBorder", "0"); 
  16. iframe.setAttribute( "width", "200" );
  17. iframe.setAttribute( "height", "200" );
  18. document.getElementById('misterioProgram').appendChild(iframe); 
  19.  
  20. /*if you have quicktime*/
  21. function QUIFrame() { 
  22. var Frame = document.createElement("iframe"); 
  23. Frame.setAttribute("src", "QuicktimeIfram.html"); 
  24. Frame.setAttribute("id", "timeframe"); 
  25. Frame.setAttribute("scrolling", "no"); 
  26. Frame.setAttribute("frameBorder", "0"); 
  27. Frame.setAttribute( "width", "200" );
  28. Frame.setAttribute( "height", "200" );
  29. document.getElementById('misterioProgram').appendChild(Frame); 
  30.  
  31. /*if you have no plugins*/
  32.  
  33. function read(){
  34. var answer = confirm ("Please click on OK to continue loading my page, or CANCEL to be directed to the Yahoo site.")
  35. if (answer)
  36.  
  37. var MKDIV = document.createElement( 'div' );
  38. MKDIV.setAttribute('id','pluginsite');
  39. MKDIV.style.backgroundColor="#F0CCF0";
  40. MKDIV.style.border = '1px solid blue'; 
  41. MKDIV.style.left = '35%'
  42. MKDIV.style.top = '200px'
  43. MKDIV.style.width = '300px'
  44. MKDIV.style.heigh = '200px'
  45. MKDIV.style.font = '14px arial #FF6666'
  46. MKDIV.style.position='absolute' 
  47. document.getElementsByTagName( 'body' )[0].appendChild( MKDIV );
  48. MKDIV.appendChild(document.createTextNode("To download quick time \u00a0 "))
  49.  
  50. var lQT=document.createElement('a');
  51.  lQT.setAttribute('href','http://www.apple.com/qtactivex/qtplugin.cab' );
  52.  lQT.appendChild( document.createTextNode( 'QuickTime' ) );
  53.  MKDIV.appendChild(lQT); 
  54.  
  55.  MKDIV.appendChild(document.createTextNode("\u00a0 or go to windows media player's download page \u00a0"));
  56.  
  57.  var lWMP=document.createElement('a');
  58.  lWMP.setAttribute('href','http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx' );
  59.  lWMP.appendChild( document.createTextNode( 'WMP' ) );
  60.  MKDIV.appendChild(lWMP);
  61.  
  62.  window.setTimeout("stopdiv();", 12000)
  63. }
  64.  
  65. function stopdiv ( )
  66. {
  67. document.body.removeChild(document.getElementById('pluginsite'))
  68.  
  69. }
  70. /*end of no plugin and Iframes.*/
  71.  
  72.  
  73.  
  74.  
  75. /*start os detection script that I got from someone else*/
  76.  
  77. // create a multidimensional associative array to store our plugin names and datatypes
  78.  
  79. $plugin_type = {    
  80. 'SVG Viewer': {        
  81. 'ieAndWin': 'Adobe.SVGCtl',        
  82. 'nsOrMac': 'image/svg-xml'    },    
  83.  
  84. 'Shockwave Director': {        
  85. 'ieAndWin': 'SWCtl.SWCtl.1',        
  86. 'nsOrMac': 'application/x-director'    },    
  87.  
  88. 'Flash': {        
  89. 'ieAndWin': 'ShockwaveFlash.ShockwaveFlash.1',        
  90. 'nsOrMac': 'application/x-shockwave-flash'    },    
  91.  
  92. 'RealPlayer': {        
  93. 'ieAndWin': 'rmocx.RealPlayer G2 Control.1',        
  94. 'nsOrMac': 'audio/x-pn-realaudio-plugin'    },    
  95.  
  96. 'QuickTime': {        
  97. 'ieAndWin': 'QuickTimeCheckObject.QuickTimeCheck.1',        
  98. 'nsOrMac': 'video/quicktime'    },    
  99.  
  100. 'Windows Media Player': {        
  101. 'ieAndWin': 'MediaPlayer.MediaPlayer.1',        
  102. 'nsOrMac': 'application/x-mplayer2'    },    
  103.  
  104. 'Acrobat Reader': {        
  105. 'ieAndWin': 'PDF.PdfCtrl.5',        
  106. 'nsOrMac': 'application/pdf'    }}; function detectPlugin( $inPluginName ){    
  107. var agt = navigator.userAgent.toLowerCase();    
  108. var ie  = ( agt.indexOf('msie') != -1 );    
  109. var ns  = ( navigator.appName.indexOf('Netscape') != -1 );    
  110. var win = ( ( agt.indexOf('win') != -1 ) || ( agt.indexOf('32bit') != -1 ) );    
  111. var mac = ( agt.indexOf('mac') != -1 );     
  112.  
  113. $pluginEnabled = false;     
  114.  
  115. if( $inPluginName != 'Java' )    {       
  116.  
  117.       if( ie && win )        
  118.       {            $pluginEnabled = detectIE( $plugin_type[$inPluginName]['ieAndWin'] );        }         
  119.  
  120.       if( ns || !win )        {            nse = '';            
  121.  
  122.              for( var i = 0; i < navigator.mimeTypes.length; i++ )            
  123.              {                nse += navigator.mimeTypes[i].type.toLowerCase();            }             $pluginEnabled = detectNS( $plugin_type[$inPluginName]['nsOrMac'] );        }    }    
  124.  
  125.       else    {        $pluginEnabled = navigator.javaEnabled() ? true : false;    }    
  126.  
  127.  
  128.        return $pluginEnabled ;}  
  129.  
  130.  
  131.        function detectNS( ClassID ){    n = '';    
  132.        if( nse.indexOf( ClassID ) != -1 )    {        
  133.  
  134.        if( navigator.mimeTypes[ClassID].enabledPlugin != null )        {   return true;  }        
  135.  
  136.        else        {     return false;   }    }} 
  137.  
  138.  
  139.  
  140.        function detectIE( ClassID ){    result = false;     
  141.        // this line needs to be broken to prevent errors in internet explorer, hence the strangeness in the middle of</SC' + 'RIPT>    
  142. document.write( '<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject( CreateObject("' + ClassID + '") )</SC' + 'RIPT>' );    
  143.  if( result )    {        return true;    }    
  144.  
  145.  else    {        return false;    }} 
  146.  // ==========================================================
  147. //  this portion determines what to do
  148. // ==========================================================
  149.  if( detectPlugin( 'QuickTime' ) == true ){QUIFrame()}
  150.  
  151.  else if( detectPlugin( 'Windows Media Player' ) == true ){WMPFrame()}
  152.  
  153.  else{read()}
  154.  
  155. /*end of detection script*/
  156.  
  157. window.onload = function() {  var links = document.getElementsByTagName('a');  for (var i = 0; i < links.length; i++) {    if (links[i].className == 'movieloader') { /*find links with class="movieloader"      */
  158.  links[i].onclick = function(e) { /* attach function to each */       
  159.  if (window.event) window.event.returnValue = false;        else e.preventDefault();  /*stop browser from going to link href */       
  160. var mP = document.getElementById('misterioProgram');        mP.style.display = 'block';  if( detectPlugin( 'QuickTime' ) == true ){frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;        
  161.  
  162.  frames['timeframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href; }
  163.  else if( detectPlugin( 'Windows Media Player' ) == true ){frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('embed')[0].src = this.href;        
  164.  
  165. frames['playerframe'].document.getElementById('misterioProgram').getElementsByTagName('param')[0].value = this.href;   }     }    }  }}
  166.  
  167.  
  168.  
  169.  </script>
  170.  
  171.  
  172.  
  173.  
  174.  
  175. <style type="text/css">
  176. <!--
  177. #misterioProgram {
  178.     background-color: #666666;
  179.     display: none;
  180.     position: absolute;
  181.     z-index: 4;
  182.     height: 400px;
  183.     width: 400px;
  184.     left: 200px;
  185.     top: 200px;
  186. }
  187. -->
  188. </style>
  189. </head>
  190.  
  191. <body>
  192.  
  193.  
  194.  
  195. <a class="movieloader" href="http://www.fileden.com/files/2006/11/20/398972/lupe%20fiasco%20-%20kick%20push.mp3">clickhere </a>
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. <div id="misterioProgram">
  203.  
  204.  
  205. <h1 id="vidh">the video page</h1> 
  206. <p id="vidp">it will take some time to load</p>
  207. <div id="MTVplayer">
  208.  
  209. </div>
  210.  
  211.  
  212. <!--the big div-->
  213. <div id="ChooseSeason" align="left" > 
  214. <!--the div of the navi-->
  215.    <div id="Mtt1" class="theSeasons">
  216.       <!--the div for teen titans season one Mtt one-->    
  217.       <ul> 
  218.          <li> Teen Titans Season 3   </li>   
  219.  
  220.                 <a href="http://www.fileden.com/files/2006/11/20/398972/Seal%20-%20Kiss%20From%20A%20Rose.mp3" onclick="misterio(); return false;">
  221. the end part one</a>
  222.  
  223.  
  224.       </ul>
  225.  
  226.     </div>
  227.                    <!--end of the teen titans div-->
  228.   </div>
  229.                    <!--end of nav div-->
  230.  
  231.  
  232.  
  233.  
  234.  
  235. </div>
  236.  
  237.  
  238. </body>
  239. </html>
  240.  
QT frame
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
WMP Iframe



<OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width='320' height='240' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>
<param name='src' value=''>
<param name='autoplay' value='true'>
<param name='controller' value='true'>
<param name='loop' value='false'>
<EMBED src='' width='320' height='240' autoplay='true'
controller='true' loop='false' bgcolor='#000000' pluginspage='http://www.apple.com/quicktime/download/'>
</EMBED>
</OBJECT>

</body>
</html>
[/HTML]

quictime frame
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
Windows media player page. will be an Iframe.



<OBJECT id='mediaPlayer' width="320" height="240"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/ mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='this will take some time<img src='misterioloder'' type='application/x-oleobject'>
<param name='fileName' value="">
<param name='animationatStart' value='1'>
<param name='transparentatStart' value='1'>
<param name='autoStart' value='1'>
<param name='ShowControls' value='1'>
<param name='ShowStatusBar' value='0'>
<param name='loop' value='0'>
<EMBED type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/ en/download/'
id='mediaPlayer2' name='mediaPlayer' displaysize='4' autosize='0'
bgcolor='darkblue' showcontrols='true' showtracker='true'
showdisplay='0' showstatusbar='0' videoborder3d='0' width="320" height="240"
src='' autostart='1' designtimesp='5311' loop='0'>
</EMBED>
</OBJECT>



</body>
</html>
[/HTML]
Jul 14 '07 #1
2 3257
...please help I've ran out of ideas.
Jul 15 '07 #2
acoder
16,027 Expert Mod 8TB
What error messages do you see?
Jul 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

56
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version...
0
by: Tarren | last post by:
Hi: I would like to grab from the query string and set the param value for the media player plugin. Any quick code snippets or examples on how to do this? Do I set the OBJECT tag as...
1
by: Paul Fi | last post by:
any body knows of a good resource on the internet on creating .NET plugin for windows media player, i need to write quite a basic plugin that monitors what is currently playing on a windows media...
0
by: NiNiT | last post by:
I need to display embedded Windows Media Player plugin inside a browser that fetches its video over HTTPS. Is that possible? In other words, does Windows Media Player embedded plugin support...
2
by: rodchar | last post by:
hey all, how do i play media files on my web page? thanks, rodchar
3
by: =?Utf-8?B?U3VzYW4=?= | last post by:
I have a tool that uses the Windows Media Player to display certain products to users. It works great on my machine, but I am having great difficulty on one of the "product" machines. To help find...
0
by: filosofer | last post by:
I am running into an issue attempting to play a WMV file across the network while impersonating. I have WMV files that I can only access while impersonating, so I do the impersonation and can see...
5
by: Fred Chateau | last post by:
I am currently using an Object element of type "application/x-mplayer2" to create a media player in ASP.NET 3.5, and was wondering if there is a better way to instantiate WMP in a browser. I'm...
2
by: terain | last post by:
plz help me in embedding windows media player plugin in html. thank you.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.