Advertisement:

Author Topic: [PAID/FREE] BBcode to embed videos from clipbucket  (Read 11192 times)

Offline johngranlet

  • Newbie
  • *
  • Posts: 5
[PAID/FREE] BBcode to embed videos from clipbucket
« on: January 29, 2013, 03:35:43 PM »
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
Code: [Select]
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.

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,524
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #1 on: January 29, 2013, 04:34:09 PM »
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.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johngranlet

  • Newbie
  • *
  • Posts: 5
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #2 on: January 29, 2013, 04:51:26 PM »
my smf site is  hxxp:mpiremall.info [nonactive] the defiledstudios.com 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 )

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,524
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #3 on: January 29, 2013, 05:01:53 PM »
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.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johngranlet

  • Newbie
  • *
  • Posts: 5
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #4 on: January 29, 2013, 05:05:22 PM »
Code: [Select]
[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

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,524
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #5 on: January 29, 2013, 05:34:07 PM »
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:

Code: [Select]
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:

Code: [Select]
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.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline johngranlet

  • Newbie
  • *
  • Posts: 5
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #6 on: January 29, 2013, 05:37:12 PM »
I'll try that out right now.you are awesome btw :)


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

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,524
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #7 on: January 29, 2013, 05:38:46 PM »
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.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline reignerz

  • Newbie
  • *
  • Posts: 3
Re: [PAID/FREE] BBcode to embed videos from clipbucket
« Reply #8 on: May 28, 2013, 11:08:24 PM »
You can create a simple bbc tag:

Code: [Select]
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 ?
Code: [Select]
// 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:

Code: [Select]
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]