miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · 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:43Reply Quote
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:50Reply Quote
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:52Reply Quote
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 Lead Developer
#4 · Posted: 17 Feb 2009 11:00Reply Quote
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

BB code for the Bold StyleBB code for the Italic StyleBB Code for the PictureBB code for the URLUpload a File

  ?
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
Try the File and Picture Attachments add-on: extend your miniBB-forums, attaching images and files.