Videos don't display in multilingual sites
| Project: | Video |
| Version: | 6.x-2.5-beta1 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | heshanmw |
| Status: | postponed (maintainer needs more info) |
Jump to:
In multilingual sites, using url() to get the base path of the flash player doesn't work. Here is a fix I use, not sure it's the best solution though.
Index: sites/all/modules/video/includes/common.inc
===================================================================
--- sites/all/modules/video/includes/common.inc (revision 80)
+++ sites/all/modules/video/includes/common.inc (working copy)
@@ -78,7 +78,7 @@
// this will be executed by not Internet Explorer browsers
$output = ' <-->
video_scaled_x .'" height="'. $height .'"
-data="'. url() . check_plain($loader_location) .'">
+data="'. substr(url(), 0, strrpos(url(), "?")) . check_plain($loader_location) .'">
' . "\n";
// this will be executed by Internet Explorer
@@ -90,7 +90,7 @@
// params will be passed to both IE or not IE browsers
$config = sprintf("config={'playerId':'player','clip':{'url':'%s'},'playlist':[{'url':'%s','autoPlay':%s}]}", $base_url . '/' . $file, $base_url . '/' . $file, (variable_get('video_autoplay', TRUE) ? 'true' : 'false'));
- $output .= '
+ $output .= '

#1
Hmm, I see... So Drupal API url() apparently returns ?query under certain conditions -- one of them being when multilingual is used? I don't have any ML sites to test this against, but a simple reading of your code indicates it won't work on sites where url() doesn't return a ?query (because strrpos will return false) - you may need an (strrpos ? strrpos : strlen) construct there instead.
Also, why are you using strrpos? Shouldn't strpos be used (first occurrence of ?query)?
If we can get a correct fix on your ML site that handles your situation, I'll port it to common.inc for everyone else.
Thanks for your assistance.
--glen
#2
Ok, did some more testing:
- with clean URLs enabled, url() returns BASE_PATH/LANGUAGE_CODE (eg. /en or /projectname/en);
- without clean URLs, url() returns BASE_PATH/?q=LANGUAGE_CODE (eg. /?q=en or /projectname/?q=en).
Now I think url() is not really the function you should be using here. Do you see a problem with using base_path() instead? It seems to work fine with my tests, but I obviously don't know this project very well...
#3
It just happened to me. Anything new on this ?
chmoindron : I suspect that your post have been truncated by the parser of this site... Could you post your code with the < code > tag ?
Thanks in advance!
Plascual
#4
Nothing was truncated. My patch is actually very simple: two url() calls replaced by base_path() calls, in theme_video_play_flash(). Here is the diff against current HEAD. It works for me, without any side effect. However, once again, I don't know this project very well, so I would advise waiting for glen201 to confirm the fix.
--- common.inc.ref 2009-08-06 18:19:23.000000000 +0200
+++ common.inc 2009-09-14 10:11:58.453383979 +0200
@@ -76,7 +76,7 @@
// this will be executed by not Internet Explorer browsers
$output = '<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" width="'. $node->video_scaled_x .'" height="'. $height .'"
-data="'. url() . check_plain($loader_location) .'">
+data="'. base_path() . check_plain($loader_location) .'">
<!--> <![endif]-->' . "\n";
// this will be executed by Internet Explorer
@@ -88,7 +88,7 @@
// params will be passed to both IE or not IE browsers
$config = sprintf("config={'playerId':'player','clip':{'url':'%s'},'playlist':[{'url':'%s','autoPlay':%s}]}", $base_url . '/' . $file, $base_url . '/' . $file, (variable_get('video_autoplay', TRUE) ? 'true' : 'false'));
- $output .= '<param name="movie" value="' . url() . check_plain($loader_location) . '" />
+ $output .= '<param name="movie" value="' . base_path() . check_plain($loader_location) . '" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="allowScriptAccess" value="sameDomain" />
#5
hi ..I used to be able to view the video in the node's page, on my i18n site. But now, no video is being shown, just a description. I don't have anything like the below in page source:
<param name="movie" value="/FlowPlayer.swf" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="quality" value="high" />
<param name="flashvars" value="config={'playerId':'player','clip':{'url':'http://video.heidisoft.com/files/videos/superstunt_8uiarzrh_0.mp4.flv'},'playlist':[{'url':'http://video.heidisoft.com/files/videos/superstunt_8uiarzrh_0.mp4.flv'}]}" /><p>Your browser is not able to display this multimedia content.</p>
</object><p>
what would be the cause?
#6
what is your Drupal version?
#7
heshanmw, have you had time to look at the bugfix I suggest in #4?
#8
For me, this is fixed using the latest version
#9
Strange, it works for me on a trilingual site, although with some hard to explain side effects requiring manual database cleanup.
I can change the Video content type to multilingual, and I can upload different videos for different languages. However, the most recently uploaded video is the one that will show up in all translations.
I had to edit the "video_upload" table and manually edited the "fid" column value to correct the wrong link to the uploaded file (while looking at the "files" table).
Best regards,
Olivier