MyBB Community Forums

Full Version: javascript in posts (for specific forum)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2009-02-09, 02:27 AM)Yumi Wrote: [ -> ]You need to have the <p> tag in the actual replacement.
Ok, I''ve changed the replacement code like you've shown above. Now the output in the post is: "The player will show in this paragraph" but there's no player, just the text output.

(2009-02-09, 02:27 AM)Yumi Wrote: [ -> ]BTW, if you didn't know, there will be issues if there are multiple instances of this on a single page.
Really? How come? Is it the way the player/script works or is it because it's a custom MyCode? Should I use a different player code? Are there any other ways that you know off to implement something like this, so it works like the standard IMG tag for example?

I don't know a lot about coding so bear with me Smile
(2009-02-09, 01:07 PM)zoog Wrote: [ -> ]
(2009-02-09, 02:27 AM)Yumi Wrote: [ -> ]You need to have the <p> tag in the actual replacement.
Ok, I''ve changed the replacement code like you've shown above. Now the output in the post is: "The player will show in this paragraph" but there's no player, just the text output.
Give me an example of such a post so I can see what's going on.

(2009-02-09, 01:07 PM)zoog Wrote: [ -> ]
(2009-02-09, 02:27 AM)Yumi Wrote: [ -> ]BTW, if you didn't know, there will be issues if there are multiple instances of this on a single page.
Really? How come? Is it the way the player/script works or is it because it's a custom MyCode? Should I use a different player code? Are there any other ways that you know off to implement something like this, so it works like the standard IMG tag for example?
To get around the issue would require a fair bit of modification to SWFObject (if you want to use it), a custom plugin, or you using <object>/<embed> tags instead of SWFObject...
First off, thanks for your time so far Yumi Smile

Here's an example post: http://www.tangodown.nl/forum/showthread.php?tid=237

Quote:To get around the issue would require a fair bit of modification to SWFObject (if you want to use it), a custom plugin, or you using <object>/<embed> tags instead of SWFObject...
Ok, so does that basically mean that I need a different video player which uses a <object>/<embed> tag or can a simple modifcation to the existing player give the same result?
You're not putting a reference to swfobject.js anywhere in the header... make sure something like the following is in your headerinclude template:
<script type="text/javascript" src="swfobject.js"></script>

SWFObject basically just writes out the <embed> tag. You can use an <embed> tag directly instead, at the cost of not being XHTML valid code, and losing the ability for browser Flash detection.
Ah I see, sorry, I added the code into the "index" template, but that's just of course for index.php I guess. Now I added the code to the header template, and now it works! Thanks.

I've been looking around for an embedded code and found one for this player. If you don't mind Blush, I would love to be able to use MyCode to insert videos with the embed script:

<embed 
  src="http://www.tangodown.nl/global/mediaplayer/player.swf" 
  width="400"
  height="300"
  allowscriptaccess="always"
  allowfullscreen="true"
  flashvars="file=http://www.tangodown.nl/data/streaming/video.flv"
/>

I've been reading some about invalid xhtml code, but as far as I understand it's not going to be an issue for me (?). I really need to be able to post more videos on one page.
The code:
<script type='text/javascript'>
var s1 = new SWFObject('player.swf','player','400','300','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=video.flv');
s1.write('preview');
</script>
should be equivalent to:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="400" height="300"><param name="movie" value="player.swf" /><param name="quality" value="high" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="file=video.flv" /><embed src="player.swf" quality="high" allowfullscreen="true" allowscriptaccess="always" flashvars="file=video.flv" width="400" height="300" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>
You won't need swfobject.js if you're using the HTML embed.
Nice, nice, thanks a lot Big Grin I got it working, I'll post how I changed the MyCode just in case, maybe there are errors or security issues the way I edited it. This is how my new replacement MyCode looks like (I added both the $1, $2 and $3 based on your previous MyCode and added the correct src url to the mediaplayer.swf):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="400" height="300"><param name="movie" value="player.swf" /><param name="quality" value="high" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="file=$3" /><embed src="http://www.tangodown.nl/global/mediaplayer/player.swf" quality="high" allowfullscreen="true" allowscriptaccess="always" flashvars="file=$3" width="$1" height="$2" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>

Or should I also add the $1 and $2 to the height/width of this part of the code?

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="400" height="300">
You should add it to both.
Here I am again Toungue

I just found out that the player doesn't work with IE7 (due to the object or embed code?). Well, of course I went to the support page of the player's distributor but till now it doesn't seem that the issue can be resolved using their solution posted. I hope you might know what to do, I'll just give it a shot Smile

From what I've read, for IE there needs to be a second object code. Some said I should add the following code:

<!--[if !IE]>-->
<object type="application/x-shockwave-flash" width="$1" height="$2"><param name="movie" value="player.swf" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=$3" />
</object>
<!--<![endif]-->

to the existing code so that it looks something like this (I did a few hard-returns so it's easier on the eyes):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="$1" height="$2">
<param name="movie" value="player.swf" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=$3" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" width="$1" height="$2"><param name="movie" value="player.swf" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=$3" />
</object>
<!--<![endif]-->
<embed src="http://www.tangodown.nl/global/mediaplayer/player.swf" quality="high" allowfullscreen="true" allowscriptaccess="always" flashvars="file=$3" width="$1" height="$2" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>

But it still doesn't work for IE when I use that code. I understand if it's too specific, but maybe you know what I'm doing wrong Smile
The if and endif codes aren't right for one. Try adding this...
<!--[if IE]>
<object type="application/x-shockwave-flash" width="$1" height="$2"><param name="movie" value="player.swf" />
<param name="quality" value="high" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="file=$3" />
</object>
<![endif]-->
Pages: 1 2 3