Has anyone had success with the random play feature. I seem to only get the first video in the list using the documented format as below:

[video:http://www.youtube.com/watch?v=uN1qUeId1,http://www.youtube.com/watch?v=...

CommentFileSizeAuthor
#3 318773_video_filter_random.patch1.36 KBblackdog

Comments

elanghout’s picture

I moved the code below (in video_filter.module):

// Pick random out of multiple sources separated by ','
if (strstr($video['source'], ',')) {
$sources = explode(',', $video['source']);
$random = array_rand($sources, 1);
$video['source'] = $sources[$random];
}

to just below:

function video_filter_process($text, $format = -1) {

if (preg_match_all('/\[video(\:(.+))?( .+)?\]/isU', $text, $matches_code)) {

foreach ($matches_code[0] as $ci => $code) {

$video = array(
'source' => $matches_code[2][$ci],
'width' => variable_get('video_filter_width_'.$format, 400),
'height' => variable_get('video_filter_height_'.$format, 400),
'autoplay' => variable_get('video_filter_autoplay_'.$format, 0),
);

And that works!

blackdog’s picture

Category: support » bug

@elanghout - could you create a proper patch of this please?

blackdog’s picture

Status: Active » Fixed
StatusFileSize
new1.36 KB

Committed attached patch. Thanks elanghout.

FirstPersonShow-Kevin’s picture

I've not got shell access to my webhosting provider, so I downloaded the video_filter.module file and deleted the lines mentioned and added the ones you show as well. But I get the error:

Parse error: syntax error, unexpected T_ELSE in modules/video_filter/video_filter.module on line 162

?

cheers,
Kevin

blackdog’s picture

That's odd. Can you try the -dev version that's listed on the project page?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.