Random play from Comma seperated list
eblues - October 8, 2008 - 22:35
| Project: | Video Filter |
| Version: | 6.x-2.4 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
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=uN1qUeId2]

#1
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!
#2
@elanghout - could you create a proper patch of this please?
#3
Committed attached patch. Thanks elanghout.
#4
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
#5
That's odd. Can you try the -dev version that's listed on the project page?
#6
Automatically closed -- issue fixed for 2 weeks with no activity.