miniBB ®
 
miniBB Community Forum
 | Forums | File Bank | Sign Up | Reply | Search | Statistics | Manual |
Files Bank for miniBB Enrich your miniBB-forums content, creating public files storage with the File Bank add-on!
Custom Tutorials and Modifications miniBB Community Forum / Custom Tutorials and Modifications /
Short link for this topic:

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

Author Vodicka
Forums Member
#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
Forums Member
#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
Forums Member
#3 | Posted: 17 Feb 2009 06:52 | Edited by: Moderator
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
CEO
#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 Community Forum / Custom Tutorials and Modifications / Inserting stream.cz videos in posts (similarly to YouTube) Top
Your Reply Click this icon to move up to the quoted message

» Username  » Password 
You are welcome to post anonymously by entering a nickname with no password (if that nickname has not been taken by another member) or by leaving both fields empty. If you have a forums membership account, you can also sign in from this page without posting a message, or sign in and post at once.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
miniBB Community Forum Powered by Free Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts