943,962 Members | Top Members by Rank

Ad:
Oct 2nd, 2009
-1

Safari Browser Doesn't Play This Video: Why Not?

Expand Post »
Ok, I've got this code that needs to load a .wmv file - the client is adamant about using .wmv files and not Flash files - and the client insists that it use variables for the width and height parameters. Thanks to a couple of you, I've now got the code working correctly in IE (it's always worked in Firefox) but I've just noticed that it's not working in Safari. I'm sure it's got something to do with the <object> but am not sure how to fix it.

I've tried including the safari object code for wmv files and then using an if/else statement to only load the object code for safari but my javascript skills aren't that great.

Can anyone help me figure out what's wrong with the code that it's not showing up in Safari?

Here's the code:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <style type="text/css">
  4. <!--
  5. .fontStyle {
  6. font-family: Verdana, Geneva, sans-serif;
  7. font-size: small;
  8. font-weight: bold;
  9. color: #67A2DC;
  10. }
  11.  
  12. -->
  13. </style>
  14. <script type="text/javascript">
  15.  
  16. window.onload=function(){
  17. loadVideo();
  18. }
  19.  
  20.  
  21. function loadVideo()
  22. {
  23.  
  24. if (parseInt(navigator.appVersion)>3)
  25. {
  26. if (navigator.appName == "Netscape")
  27. {
  28. winW = window.innerWidth;
  29. winH = window.innerHeight;
  30. }
  31. if (navigator.appName.indexOf("Microsoft") != -1)
  32. {
  33. winW = document.body.offsetWidth;
  34. winH = document.body.offsetHeight;
  35. }
  36.  
  37. }
  38.  
  39. var dimW = winW-50;
  40. var dimH = winH-20;
  41. var w1 = dimW.toString();
  42. var h1 = dimH.toString();
  43.  
  44.  
  45.  
  46. if(document.getElementById("vidEmbed") != null)
  47. {
  48.  
  49. document.getElementById("vidEmbed").src = "Welcome_1.wmv";
  50. document.getElementById("vidEmbed").style.width = w1;
  51. document.getElementById("vidEmbed").style.height = h1;
  52. }
  53. else if(document.getElementById("Player") != null)
  54. {
  55. document.getElementById("Player").style.width = w1;
  56. document.getElementById("Player").style.height = h1;
  57. //document.getElementById("objectSrc").value = "oracleWelcome_1.wmv";
  58. document.getElementById("Player").url = "Welcome_1.wmv";
  59. }
  60. else if(document.getElementById("quickTime") != null)
  61. {
  62. document.getElementById("quickTime").style.width = w1;
  63. document.getElementById("quickTime").style.height = h1;
  64. document.getElementById("qTime").value = "oracleWelcome_1.wmv";
  65. }
  66.  
  67. }
  68. </script>
  69.  
  70. </head>
  71. <body><div>
  72. <p><span class="fontStyle">Introduction<br>
  73.  
  74. </span>
  75. <object id="Player" width="100%" height="100%" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" style="border:0px;">
  76.  
  77. <param name="autoStart" value="True">
  78. <param name="uiMode" value="full">
  79. <param name="volume" value="50">
  80. <param name="mute" value="false">
  81.  
  82. <embed src="" id="vidEmbed" width="100%" height="100%" autostart="true" uimode="full" volume="50" mute="false"> </embed>
  83. </object>
  84.  
  85. <!-- Safari Code -->
  86. <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" id="quickTime" width="100%" height="100%" codebase="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" id="qTime" value=""><param name="autoplay" value="true"><param name="controller" value="false"><embed src="" id="qTime" width="100%" height="100%" autoplay="true" controller="false" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>
  87. <!-- End Safari Code -->
  88.  
  89. </p>
  90.  
  91. </div>
  92. </body>
  93. </html>

As it stands right now, both Firefox and IE try to load the quicktime object after they load the wmv movie object and I'm sure it's because I've coded incorrectly. Any help you can give is greatly appreciated.

Thank you,

M.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
edDev is offline Offline
8 posts
since Sep 2009
Oct 2nd, 2009
0

Re: Safari Browser Doesn't Play This Video: Why Not?

That's because you are embedding QT instead of WMP!
<html>
	<head>
    <style type="text/css">
<!--
.fontStyle {
	font-family: Verdana, Geneva, sans-serif;
	font-size: small;
	font-weight: bold;
	color: #67A2DC;
}

-->
    </style>
		<script type="text/javascript">			

			window.onload=function(){
				loadVideo();
			}
			
	
			function loadVideo()
			{
				
					if (parseInt(navigator.appVersion)>3)
						{
							if (navigator.appName == "Netscape")
							{
								winW = window.innerWidth;
								winH = window.innerHeight;
							}
					if (navigator.appName.indexOf("Microsoft") != -1)
							{
								winW = document.body.offsetWidth;
								winH = document.body.offsetHeight;
							}
					
			}
				
				var dimW = winW-50;
				var dimH = winH-20;
				var w1 = dimW.toString();
				var h1 = dimH.toString();
				
				
				
				if(document.getElementById("vidEmbed") != null)
				{
					
					document.getElementById("vidEmbed").src = "Welcome_1.wmv";
					document.getElementById("vidEmbed").style.width = w1;
					document.getElementById("vidEmbed").style.height = h1;
				}
				else if(document.getElementById("Player") != null)
				{
					document.getElementById("Player").style.width = w1;
					document.getElementById("Player").style.height = h1;
					document.getElementById("Player").url = "Welcome_1.wmv";
				}
else if(document.getElementById("quickTime") != null)
				{
					document.getElementById("quickTime").style.width = w1;
					document.getElementById("quickTime").style.height = h1;
					document.getElementById("qTime").value = "oracleWelcome_1.wmv";
				}

			}
		</script>

	</head>
<body><div>
<p><span class="fontStyle">Introduction<br>

</span> 
   <object id="Player" width="100%" height="100%" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" style="border:0px;"> 
    
    <param name="autoStart" value="True">
    <param name="uiMode" value="full">
    <param name="volume" value="50">
    <param name="mute" value="false">
<!-- <embed src="" id="vidEmbed" width="100%" height="100%" autostart="true" uimode="full" volume="50" mute="false"></embed> -->
<embed type="application/x-mplayer2" src="" id="vidEmbed" width="100%" height="100%" autostart="true" uimode="full" volume="50"> </embed>  

  </object>
   
   <!-- Safari Code -->
    <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" id="quickTime" width="100%" height="100%" codebase="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" id="qTime" value=""><param name="autoplay" value="true"><param name="controller" value="false"><embed src="" id="qTime" width="100%" height="100%" autoplay="true" controller="false" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>
 <!-- End Safari Code -->
  
</p>

</div>
</body>
</html>
Might work
Reputation Points: 120
Solved Threads: 61
Posting Pro
Troy III is online now Online
511 posts
since Jun 2008
Oct 2nd, 2009
0

Re: Safari Browser Doesn't Play This Video: Why Not?

Thanks for trying. That little bit of extra code (type="application/x-mplayer2") in the embed tag actually causes FF to stop showing the file. I don't know why but it does.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
edDev is offline Offline
8 posts
since Sep 2009
Oct 2nd, 2009
0

Re: Safari Browser Doesn't Play This Video: Why Not?

Click to Expand / Collapse  Quote originally posted by edDev ...
Thanks for trying. That little bit of extra code (type="application/x-mplayer2") in the embed tag actually causes FF to stop showing the file. I don't know why but it does.
Something is wrong with your Safari [although I don't have it here] because your previous code [the one working on FX and IE] should have worked in Safari too, 'cause this code is trying to use windows media player v.6.4 edition. But as I've already mentioned safari will also need its WMP plug-in installed same as FX, which already has it.
Reputation Points: 120
Solved Threads: 61
Posting Pro
Troy III is online now Online
511 posts
since Jun 2008
Oct 2nd, 2009
0

Re: Safari Browser Doesn't Play This Video: Why Not?

Click to Expand / Collapse  Quote originally posted by Troy III ...
Something is wrong with your Safari [although I don't have it here] because your previous code [the one working on FX and IE] should have worked in Safari too, 'cause this code is trying to use windows media player v.6.4 edition. But as I've already mentioned safari will also need its WMP plug-in installed same as FX, which already has it.
I believe you may be right. Someone is testing from his safari browser for me now.

Thank you
Reputation Points: 10
Solved Threads: 0
Newbie Poster
edDev is offline Offline
8 posts
since Sep 2009
Mar 16th, 2010
0
Re: Safari Browser Doesn't Play This Video: Why Not?
did you get this to work in the end, i have been trying to get something like this to work on an IPhone using Safari Browser but can not get it to play a sound on load.

i have it play the alert sound onload with firefox and IE and every mobile i have tried also works, but as for he IPhone it is not working, it is not playing the sound file.

i have tried both .mp3 and .wav file types

how would I correctly have it play a sound in the browser normally in this type of browser?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jasonc31 is offline Offline
5 posts
since Mar 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Ajax Javascript help needed!
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Fading a <div>





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC