[PAID/FREE] BBcode to embed videos from clipbucket

Started by johngranlet, January 29, 2013, 03:35:43 PM

Previous topic - Next topic

johngranlet

First let me start by saying I'm more then willing to pay for this as it's been driving me nuts but my budget is low ($16) as we're just a small site.

I currently run a smf forum and we have a clipbucket ( video hosting ) site dedicated to our forum however we currently have to embed video's using  bbcodes that are only usable by admins ( security reasons ) and this makes it annoying when regular users wish to post a video.

we've tried many modifications to get around this and none have worked so far due to clipbuckets strange code.

so what we need is a way to easily embed video's either by simply puting a link in the forum post ( webaddress/watch_video.php?v=N5K5GWHDD8S8 ) for example or a bbcode that would take a link like [dvid]N5K5GWHDD8S8[/dvid] and parse that to display the correct video

I've also been trying to get this mod to work with it.... Embed BBCode

tried changing this array(
'tag' => 'embed',
'type' => 'unparsed_commas_content',
'test' => '\d+,\d+\]',
'content' => ($context['browser']['is_ie'] && !$context['browser']['is_mac_ie'] ? '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="$2" height="$3"><param name="movie" value="$1" /><param name="AllowScriptAccess" value="always" /><param name="AllowFullScreen" value="true" /><embed src="$1" width="$2" height="$3" AllowScriptAccess="always" AllowFullScreen="true" /><noembed><a href="$1" target="_blank" class="new_win">$1</a></noembed></object>' : '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" AllowScriptAccess="always" AllowFullScreen="true" /><noembed><a href="$1" target="_blank" class="new_win">$1</a></noembed>'),
'validate' => create_function('&$tag, &$data, $disabled', '
if (isset($disabled[\'embed\']))
$tag[\'content\'] = \'$1\';
  global $context;
if (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])(?:http|https)://www.(?:youtube|youtube-nocookie).com/embed/(.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.youtube.com/v/\' . $matches[1];
elseif (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])http://www.dailymotion.com/embed/video/(.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.dailymotion.com/swf/video/\' . $matches[1];
elseif (preg_match(\'~iframe.+src=(?:&quot;|[\\\'"])http://player.vimeo.com/video/(.*?)\?.+(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://vimeo.com/moogaloop.swf?clip_id=\' . $matches[1];
elseif (preg_match(\'~http://www.youtube.com/watch[?]v=(.+)~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.youtube.com/v/\' . $matches[1] . \'&fs=1\';
elseif (preg_match(\'~http://youtu.be/(.+)~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://www.youtube.com/v/\' . $matches[1] . \'&fs=1\';
elseif (preg_match(\'~embed.+src=(?:&quot;|[\\\'"])((?:http|https)://(?:www.)?(?:youtube|youtube-nocookie|dailymotion|vimeo|metacafe|megavideo|veoh).com/.*?)(?:&quot;|[\\\'"])~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = $matches[1];
elseif (preg_match(\'~http://defiledstudios.com/watchvideo.php[?]v=(.+)~i\'.($context[\'utf8\'] ? \'u\' : \'\'), $data[0], $matches))
$data[0] = \'http://defiledstudios.com/watchvideo.php/v/\' . $matches[1] . \'&fs=1\';
else
$tag[\'content\'] = \'$1\';
'),
'disabled_content' => '<a href="$1" target="_blank" class="new_win">$1</a>',
),
( last line is my edit )

but doesn't work any help is welcome a kick in the right direction a completion of my request anything at all is welcome...thank you.

Suki

Is this your site?
http://defiledstudios.com/

How do you normally share videos? whats the code you use to share videos from that site?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

johngranlet

my smf site is  hxxp:mpiremall.info [nonactive] the hxxp:defiledstudios.com [nonactive] is the clipbucket site

to post videos we usually use the html bbcodes and stick the embed code from the clipbucket site inside those ( this works great but normal non-admin types can't use it )

Suki

Whats the exact code you use when you use the HTML tags.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

johngranlet

[html]<embed src="http://defiledstudios.com/player/cbplayer/player.swf?config=http%3A%2F%2Fdefiledstudios.com%2Fplayer%2Fcbplayer%2Fembed_player.php%3Fvid%3D1100%26autoplay%3Dno" type="application/x-shockwave-flash"allowscriptaccess="always" allowfullscreen="true"  width="300" height="250"></embed> [/html]

and that works great plays vid etc

Suki

http://defiledstudios.com/player/cbplayer/embed_player.php?vid=1100&autoplay=no

Is this the generic url used for all videos? meaning it will only change the video ID, in this case the video ID is 1100

You can create a simple bbc tag:


array(
'tag' => 'clipbucket',
'type' => 'unparsed_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', '
global $txt;

if (empty($data))
$data = \'No valid link\';

else
{
$data = trim(strtr($data, array(\'<br />\' => \'\')));
$data = clipbucket($data);
}
'),
'disabled_content' => '$1',
'block_level' => true
)


and then on the clipbucket() function you pass the link:


function clipbucket($data)
{
    return '<embed src="http://defiledstudios.com/player/cbplayer/player.swf?config='. $data .'" type="application/x-shockwave-flash"allowscriptaccess="always" allowfullscreen="true"  width="300" height="250"></embed>';
}


Which is the most basic function you can have, now put that function at the end of Subs.php before the ?> and you can use the tag like this:

[clipbucket]http://defiledstudios.com/player/cbplayer/embed_player.php?vid=1100&autoplay=no[/clipbucket]
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

johngranlet

I'll try that out right hxxp:now.you [nonactive] are awesome btw :)


*works perfectly!!!! you are my hero where do you want my feeble $ sent?

Suki

It is totally untested so don't try it on a live site, use a demo board or demo site
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

reignerz

Quote from: Suki on January 29, 2013, 05:34:07 PM
You can create a simple bbc tag:


array(
'tag' => 'clipbucket',
'type' => 'unparsed_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', '
global $txt;

if (empty($data))
$data = \'No valid link\';

else
{
$data = trim(strtr($data, array(\'<br />\' => \'\')));
$data = clipbucket($data);
}
'),
'disabled_content' => '$1',
'block_level' => true
)




hello Suki, i have the same problem with johngranlet
can u please tell me where to put above code ?

is it correct after this line ?

// Let mods add new BBC without hassle.
call_integration_hook('integrate_bbc_codes', array(&$codes));







and then on the clipbucket() function you pass the link:


function clipbucket($data)
{
    return '<embed src="http://defiledstudios.com/player/cbplayer/player.swf?config='. $data .'" type="application/x-shockwave-flash"allowscriptaccess="always" allowfullscreen="true"  width="300" height="250"></embed>';
}


Which is the most basic function you can have, now put that function at the end of Subs.php before the ?> and you can use the tag like this:

[clipbucket]http://defiledstudios.com/player/cbplayer/embed_player.php?vid=1100&autoplay=no[/clipbucket]

Advertisement: