miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Inserting stream.cz videos in posts (similarly to YouTube)

 
Author Vodicka
Partaker
#1 | Posted: 17 Feb 2009 06:43 
There is some dmeand for embedding videos from service called stream.cz into posts. It is Czech compmetition to YouTube.

We are talking about bb_codes.php here-
Well, what I managed to implement thEncode part well and it works to my own surprise. Let me show you both (YouTube And Streamcz) side to side:

/* YouTube code */
$pattern[]="/\[youtube=http:\/(\/www\.|\/[a-z]+\.|\/)youtube\.com\/watch\?v=([a-zA-Z0-9-_]+)(.*)\]/i";
$replacement[]="<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http://www.youtube.com/v/\\2\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/\\2\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"344\"></embed></object>";
/* --YouTube code */
/* Stream code */
$pattern[]="/\[streamcz=http:\/(\/www\.|\/[a-z]+\.|\/)stream\.cz\/video\/([a-zA-Z0-9-_]+)(.*)\]/i";
$replacement[]="<object width=\"450\" height=\"296\"></param><param name=\"allowfullscreen\" value=\"true\"><param name=\"wmode\" value=\"transparent\">
<embed src=\"http://www.stream.cz/object/\\2\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" allowfullscreen=\"true\" height=\"354\" width=\"450\"></embed></object>";
/* --Stream code */

Author Vodicka
Partaker
#2 | Posted: 17 Feb 2009 06:50 
What does not work is the decode part:

/* YouTube decode */
$pattern[]="/<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"http:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9-_]+)\"><\/param><param name=\"wmode\" value=\"transparent\"><\/param><embed src=\"http:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9-_]+)\" type=\"application\/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"344\"><\/embed><\/object>/i";
$replacement[]="[youtube=http://www.youtube.com/watch?v=\\1]";
/* --YouTube decode */
/* Stream decode */
$pattern[]="/<object width=\"450\" height=\"296\"><\/param><param name=\"allowfullscreen\" value=\"true\"><param name=\"wmode\" value=\"transparent\">
<embed src=\"http:\/\/www\.stream\.cz\/object\/([a-zA-Z0-9-_]+)\" type=\"application\/x-shockwave-flash\" wmode=\"transparent\" allowfullscreen=\"true\" height=\"354\" width=\"450\"><\/embed><\/object>/i";
$replacement[]="[streamcz=http://www.stream.cz/video/\\1]";
/* -- Stream decode */

Author Vodicka
Partaker
#3 | Posted: 17 Feb 2009 06:52 
As I am not programmer I proceeded only by method of analogy, but have made mistake somewhere.

The usual link of StreamCZ video is like this:
http://www.stream.cz/video/240878-recept-na-hajz-v-politice

And the embed code is "prescribed) like this:

<object height="296" width="450"><param name="movie" value="http://www.stream.cz/object/240878-recept-na-hajz-v-politice"><param name="allowfullscreen" value="true"><param name="wmode" value="transparent"><embed src="http://www.stream.cz/object/240878-recept-na-hajz-v-politice" type="application/x-shockwave-flash" wmode="transparent" allowfullscreen="true" height="354" width="450"></object>
Can you see my mistake?

Author Paul
Lead Developer 
#4 | Posted: 17 Feb 2009 11:00 
The correct code should be:

$pattern[]="/<object width=\"450\" height=\"296\"><\/param><param name=\"allowfullscreen\" value=\"true\"><param name=\"wmode\" value=\"transparent\"><br \/><embed src=\"http:\/\/www\.stream\.cz\/object\/([a-zA-Z0-9-_]+)\" type=\"application\/x-shockwave-flash\" wmode=\"transparent\" allowfullscreen=\"true\" height=\"354\" width=\"450\"><\/embed><\/object>/i";

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Inserting stream.cz videos in posts (similarly to YouTube)
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑