http://atutor.ca/atutor/mantis/view.php?id=4574
[acontent.git] / docs / include / lib / resources_parser.inc.php
index 2daf5f6..4c676fc 100644 (file)
@@ -136,6 +136,15 @@ foreach ($my_files as $file) {
                continue;
        }
        
+    // The URL of the movie from youtube.com has been converted above in embed_media().
+       // For example:  http://www.youtube.com/watch?v=a0ryB0m0MiM is converted to
+       // http://www.youtube.com/v/a0ryB0m0MiM to make it playable. This creates the problem
+       // that the parsed-out url (http://www.youtube.com/v/a0ryB0m0MiM) does not match with
+       // the URL saved in content table (http://www.youtube.com/watch?v=a0ryB0m0MiM).
+       // The code below is to convert the URL back to original.
+       $file = preg_replace("/(http:\/\/[a-z0-9\.]*)?youtube.com\/v\/(.*)/",
+                            "\\1youtube.com/watch?v=\\2", $file);
+       
        $resources[$i] = $file;
        $i++;
 }