By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,045 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,045 IT Pros & Developers. It's quick & easy.

'flashvideoplayer' is null or not an object

P: 6
I have this page that works great in every browser I've tried except IE. It uses javascript to pass variables to a .swf and whenever I look at it in IE it give me this error:

'flashvideoplayer' is null or not an object.


This is the page that I'm working on:
http://www.hightechhigh.org/video/index2.php

The function that is giving me problems is this:

Expand|Select|Wrap|Line Numbers
  1. function initialize() {
  2. flashvideoplayer = window.videoplayer;
  3. }
  4.  
[HTML]<body onLoad="initialize();" >[/HTML]


.... which refers to my .swf file here:

[HTML]<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="450" height="338" name="videoplayer" />
<param name="allowScriptAccess" value="always" >
<param name="movie" value="video.swf" />
<embed src="video.swf" quality="high" bgcolor="#ffffff" width="450" height="338" name="videoplayer" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="videoplayer" >
</object>
[/HTML]
Unfortunately I only know enough javascript to be dangerous so
any help or suggestions would be greatly appreciated.
Nov 8 '07 #1
Share this Question
Share on Google+
15 Replies


acoder
Expert Mod 15k+
P: 16,027
You have an error in Firefox too:

flashvideoplayer.playVideo is not a function.
Nov 9 '07 #2

P: 6
You have an error in Firefox too:

flashvideoplayer.playVideo is not a function.
Thanks.

I fixed the cause of the error but found that it did not effect the problem that I'm having with IE.
Nov 9 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Since you've given the OBJECT tag an id of "videoplayer", use document.getElementById("videoplayer") to refer to it.
Nov 9 '07 #4

P: 6
Since you've given the OBJECT tag an id of "videoplayer", use document.getElementById("videoplayer") to refer to it.
Thank you very much for taking time to reply to my post.

I changed how the variable "flashvideoplayer" was defined from:
Expand|Select|Wrap|Line Numbers
  1. flashvideoplayer = window.videoplayer;
to:
Expand|Select|Wrap|Line Numbers
  1. flashvideoplayer = document.getElementById('videoplayer');
My original error went away but was replaced with this new one:

'videoplayer' is undefined

Any ideas??
Nov 13 '07 #5

acoder
Expert Mod 15k+
P: 16,027
Which line does this occur on?

It should be a line using "videoplayer" - perhaps that should be changed to flashvideoplayer?
Nov 13 '07 #6

P: 6
Which line does this occur on?

It should be a line using "videoplayer" - perhaps that should be changed to flashvideoplayer?
http://www.hightechhigh.org/video/index2.php
IE is telling me that the error is on Line: 1 Char:1

I changed all instances of "videoplayer" to "flashvideoplayer" and saved it to:
http://www.hightechhigh.org/video/index3.php
This variation also works fine on other browsers but gives me the following error in IE:
Line: 48
Char: 3
Error: Object expected
This variation does not seem like a step in the right direction. Line 48 is within the following function that is only called from a link to "start video":
42. function initFlashPlayVideo() {
43.
44. var video = "";
45. updateStatus("____" + video + "____");
46. flashvideoplayer.playVideo(video);
47. document.pauseButton.src = pauseButton.src ;
48. var play_V = document.getElementById('PLAY');
48.
50. //update page elements
51. play_V.innerHTML = "";
52. }
Nov 14 '07 #7

acoder
Expert Mod 15k+
P: 16,027
You have two elements with the same "flashvideoplayer" ID: the object and embed tag. IDs must be unique. On top of that, the name of the embed tag is also flashvideoplayer and IE is easily confused between name and ID.

I'm not sure if this will solve it, but it may help.
Nov 14 '07 #8

P: 6
You have two elements with the same "flashvideoplayer" ID: the object and embed tag. IDs must be unique. On top of that, the name of the embed tag is also flashvideoplayer and IE is easily confused between name and ID.

I'm not sure if this will solve it, but it may help.
I think it helped, I no longer have an error when the page loads in IE.

Now when I make a selection from the pull down list I am getting the following error from IE:
Line: 33
Char: 1
Error: 'flashvideoplayer' is null or not an object
Line 33 is this line within in the following function:
flashvideoplayer.playVideo("" + video);
Expand|Select|Wrap|Line Numbers
  1. /* When the user selects a movie from the pull down list on the the form, update the videoStatus text area, and call the playVideo() function within the SWF file, passing it the URL of the FLV file. */
  2. function callFlashPlayVideo() {
  3. var comboBox = document.forms['videoForm'].videos;
  4. var video = comboBox.options[comboBox.selectedIndex].value;
  5. updateStatus("____" + video + "____");
  6. flashvideoplayer.playVideo("" + video);
  7. var play_V = document.getElementById('PLAY');
  8.  
  9. //update page elements
  10. get_movie_info('getInfo.php?flv='+ video +'&return=all','film_title','video_info-title','video_info-desc','<img src="gifs/loading_animation.gif"  width="30" alt="loading.."border="0">');
  11. play_V.innerHTML = "";
  12.  
  13. }
Nov 15 '07 #9

acoder
Expert Mod 15k+
P: 16,027
I'm not sure, but this link might help in your struggles with the embed tag, i.e. try using object only.
Nov 16 '07 #10

P: 6
I'm not sure, but this link might help in your struggles with the embed tag, i.e. try using object only.
Yes it was helpful. I simplified some of the Object tags and it changed my IE error message once again.

Now when I make a selection from the pull down list I am getting the following error from IE:

Line: 33
Char: 1
Error: Object doesn't support this property or method.

Line 33 is this line within in the following function:
flashvideoplayer.playVideo("" + video);
Expand|Select|Wrap|Line Numbers
  1. /* When the user selects a movie from the pull down list on the the form, update the videoStatus text area, and call the playVideo() function within the SWF file, passing it the URL of the FLV file. */
  2. function callFlashPlayVideo() {
  3. var comboBox = document.forms['videoForm'].videos;
  4. var video = comboBox.options[comboBox.selectedIndex].value;
  5. updateStatus("____" + video + "____");
  6. flashvideoplayer.playVideo("" + video);
  7. var play_V = document.getElementById('PLAY');
  8.  
  9. //update page elements
  10. get_movie_info('getInfo.php?flv='+ video +'&return=all','film_title','video_info-title','video_info-desc','<img src="gifs/loading_animation.gif"  width="30" alt="loading.."border="0">');
  11. play_V.innerHTML = "";
  12.  
  13. }
Nov 16 '07 #11

acoder
Expert Mod 15k+
P: 16,027
So at least it's now recognising "flashvideoplayer" as an object.

What does your object tag look like now? There's no other elements with a name or id of "flashvideoplayer" now, is there?
Nov 17 '07 #12

P: 2
Hi,

i have also same problem like you.... can you give me what was your solution to avoid this problem.....

i have used same like you:

var isIE = navigator.appName.indexOf("Microsoft") != -1;
flashvideoplayer = (isIE) ? window['videoPlayer'] : document['videoPlayer'];

but still it is giving error in IE....

videoPlayer is undefined....

and let me know is there any possibility of js error in .swf file..... for creating object

plase give me replay as soon as possible.....

Thanks,
Nilesh
Nov 21 '07 #13

acoder
Expert Mod 15k+
P: 16,027
Hi

Maybe this might help you.
Nov 21 '07 #14

P: 2
Hi,

my flash embeded is like following:

[HTML]<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="740" height="420" id="FileUpload" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="FileUpload.swf?cookies=<?= $cookieString ?>&contentId=<?= $contentId ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#e1e2ff" />
<embed src="FileUpload.swf?cookies=<?= $cookieString ?>&contentId=<?= $contentId ?>" quality="high" bgcolor="#e1e2ff" width="740" height="420" name="FileUpload" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
[/HTML]
in that object tag have id="FileUpload" while embed tag have name="FileUpload" ...

is it causing any problem in IE?

when my page is loading at that time only it is giving me error in IE
"FileUpload" is undefined

i donot have much idea on flash.. so, can you tell me is it possible any javascript programming in .swf file? and may be it is casing the problem to creating object of "FileUpload"

is any wrong parameter is passed or we need more parameters in object or embe tag in IE?

Thanks,
Nov 21 '07 #15

acoder
Expert Mod 15k+
P: 16,027
in that object tag have id="FileUpload" while embed tag have name="FileUpload" ...

is it causing any problem in IE?
Yes, that is a problem in IE. IE is confused between id and name. Keep names and ids unique (to avoid IE's bug).
Nov 21 '07 #16

Post your reply

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