Social forum

Autoview Preview for Moodle 2.0

 
Picture of Mark Davis
Autoview Preview for Moodle 2.0
by Mark Davis - Monday, 6 June 2011, 9:27 PM
 
I've installed the preview and no matter where I reference my slides, they do not show up/load in Moodle (student or even as an admin creating an Autoview activity). I have tried both individual .swf files as well as .jpg files (both named according to the docs) from both my Moodle server's DB and from a separate URL that even had directory listing enabled to no avail. Are these features something that are not fully implemented yet in this preview version or am I missing something (like there needs to be an XML index file somewhere or something)? Any help would be greatly appreciated!
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Tuesday, 7 June 2011, 11:06 AM
 
Individual swfs haven't been tested with Moodle 2.x yet, but the .jpgs have and both depend on the same code so should work. All features of the Moodle 1.x version are present in Moodle 2.x.

Just checking, but are you using the Course Files Area Repository and Repository File manager on your Moodle 2 as well? If yes, can you check that the Course Files Area is 'enabled and visible' in the repository configuration. The AutoView files must be stored using these plugins, files stored in the Moodle Files DB are unlikely to work.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Tuesday, 7 June 2011, 2:15 PM
 
LOL.

No! What an idiot! Here I am properly installing a block, and a repository plug-in and I completely forget to use them! I think I'm working too hard lately. Thanks, I'll go that route and you probably won't be hearing back from me when it works...
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Tuesday, 7 June 2011, 4:45 PM
 
Bummer!

I still get the exact same results, no slides. One thing that is a bit confusing to me is that in Autoview, it asks for a slide URL, but has me pick a specific slide instead of an entire directory where all the slides are, why is this? Also, which slide should I select since each slide really is a set of 4 each named img00n_x.jpg where n is the slide number and x is 1-4 representing the slide resolution? Again, any help would be greatly appreciated.

= = ==> Mark
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Wednesday, 8 June 2011, 10:20 AM
 
The Moodle 1.x file manager doesn't have the ability to allow you to select a directory instead of a file, so the directory selection works by having you select any file within the directory and then stripping out the file name from the path.

The Repository File manager is a port of the Moodle 1.x file manager and still has the same restriction, it's on my task list to add directory selection to the code, but it hasn't been done yet since it isn't a critical feature.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Tuesday, 7 June 2011, 6:06 PM
 
I don't know if this helps any, but I have discovered that even though I can upload and select image files, if I click on one, it gives me an error message (below). I can upload and manipulate the files though...

... /repository/coursefilearea/file.php/2/Slides/img001_1.jpg

Error: Database connection failed

It is possible that the database is overloaded or otherwise not running properly.

The site administrator should also check that the database details have been correctly specified in config.php


Warning: mysqli::close() [mysql.close]: Couldn't fetch mysqli in ... /moodle/lib/dml/mysqli_native_moodle_database.php on line 336
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Wednesday, 8 June 2011, 10:38 AM
 
That's odd, the error appears to be coming at the point where the Moodle database driver tries to close the connection to the database.

/repository/coursefilearea/file.php only contains one call to the Database, which I would not expect to cause a problem.

If you haven't done so already can you also turn up the debug level to developer and see if anything interesting comes out in the server logs.

Can you also let me know exactly which build of Moodle/MySQL you are using.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Wednesday, 8 June 2011, 3:01 PM
 
I am a little skeptical that this is actually the problem, as everything else works fine and I don't get this error when viewing the Autoview page (even with debugging on), it just doesn't display the images. When I view the source code on the Autoview page, the line to display the slides is:

addSlideSource("en", new ImageSlide("Slides", ".jpg"));

As far as the other info. you asked for goes, here it is:

Moodle: 2.0.3+
MySQL: 5.0.92
Apache: 1.3.41
PHP: 5.2.17

I saw nothing interesting in the logs when I turned on debugging and set the level to developer.
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Wednesday, 8 June 2011, 6:38 PM
 
The addSlideSource bit from the AutoView source looks correct to me, assuming that the slides are in the top directory level.

Your sever setup is almost identical to mine, I have a slightly older version of MySQL but that's it.

I have found a small bug in the Repo file manager which causes an escape character to be inserted into the URL if the file chosen is 2 or more levels down within the file hierarchy. However, I don't see the offending escape character in your addSlideSource, so I don't think it is related. However, you can now download a Repo File manager update with this fix in place.

The database error is the most likely immediate cause, although this may merely be a symptom of the real underlying cause. AutoView will encounter the same error when trying to download the images, but the error is usually hidden.

I was hoping that the logs might shown an earlier error leading up to the database error.

The problem is probably in coursefilearea/file.php. There is one point in this file where i'm still using a deprecated method call to access the database, so it's possible this is the culprit. I'm going to try re-writing it and will send you an update once it's done.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Wednesday, 8 June 2011, 7:23 PM
 
Thanks, 

I'll download the update and see if it makes any difference.  One more thing that I just realized that I forgot to mention, that could make a difference, is that in Site Administration|Server|HTTP I have the "Use slash arguments" unchecked.  I have to do this because of the (old) versions of everything that our ISP is using (can't recall right off what didn't work, but when I unchecked that it worked).
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Thursday, 9 June 2011, 6:32 PM
 

Changing the "Use slash arguments" setting doesn't cause the same error to appear on my test system, so I don't think that is related.

I've also made the change to the deprecated database method, however, I don't think this line was ever being reached on your server (or mine), since it would have triggered a message saying that a deprecated method was in use, rather than the actual error you are seeing.

If you feel like making the change anyway, edit repository/coursefilearea/file.php and change the line:

        if (count_records_sql($sql)) {
to
        if ($DB->count_records_sql($sql)) {

Just checking, do you get the database connection error for all files uploaded in the coursefilesarea, or just the .jpg images?

I found this thread on moodle.org.

http://moodle.org/mod/forum/discuss.php?d=167372

which was started by somebody reporting a similar error. It seems like they needed to put a php.ini file into multiple directories within Moodle to get DB access working across Moodle on a hosted setup. Can you try out this test script (suggested by Tim Hunt in the above link) locating it in the repository/coursefilearea/ folder, so that we can establish that the DB access is working from this directory.

<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');

if (!$link) {
die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}

echo 'Success... ' . mysqli_get_host_info($link) . "\n";

mysqli_close($link);

?>
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Thursday, 9 June 2011, 7:31 PM
 
Thanks Tim.

I made the change to my file.php no avail. Also, it gives the same error for any file I have tried. I have only tried Flash .swf and JPEG .jpg files though, but they both give identical results. Also, it is true that with Moodle 2.0 and the versions of "stuff" that my ISP is using, I actually have to have a php.ini file in any/all directories that access the DB. I wrote a script that copies it to each subdirectory for me because there are soooooo many of them. Going back to the logs, in looking at them and considering the fact that I set Moodle's debug level to Developer, I'm wondering if I was looking at the correct logs. I'm a developer myself and when I set a debug level that high, I usually see more info. than I did in Moodle. Where should I be looking for the debug info.? I looked at both the ISP logs files and ran the Moodle log file reports, but they looked pretty generic to me and not at a "developer" level IMO. Thanks.


Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Friday, 10 June 2011, 10:48 AM
 
I would expect the debug info to end up in the regular apache (or equivalent) log file. However, the easiest way to find out what is going on is to activate the 'Display debug messages' option in Moodle, you'll find it in Site Admin>Development>Experimental>Debugging. It should cause the PHP warnings/errors to be displayed in your browser window. It's a bit messy, but it makes it easy to work out which errors relate to which page.

PS: The test script which should have been in my earlier message is now included above if you want to give it a try.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Friday, 10 June 2011, 3:23 PM
 
That's what I thought about the logs. I had checked the Apache logs and saw nothing. I also had changed the settings to display the debug messages, but nothing displayed on the screen other than the error I sent above. I had seen the DB script in the link you sent and it ran fine. What's weird is that the DB error message above is the exact message I get when I don't have a php.ini file in the directory trying to access the DB. I'm going to triple check to make sure I've got it in all of the subdirs for Autoview, but I'm fairly certain that I do.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Friday, 10 June 2011, 4:48 PM
 
Tim,

I decided to try to help as best I can by doing a little manual debugging myself. The coursefilearea file.php file is blowing up (giving the database error above) at the require_once that I commented out below. With that commented out, it hangs at the next require_once and never comes back; all I see is the "Before 2nd require" on the screen and no error messages or image is displayed. I don't know if that helps any, but I hope so. My MySQL configuration is using sockets if that helps any (this line is in the php.ini files in each subdirectory: mysqli.default_socket = /tmp/mysql5.sock)...

// require_once('../../config.php');
echo "Before 2nd require";
require_once('../../lib/filelib.php');
echo "Before global";
global $DB;
echo "After global";

Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Friday, 10 June 2011, 6:52 PM
 

Can you see what happens if you try to access the /repository/coursefilearea/file.php page through your browser without any path information after the file.php. You should get a message No valid arguments supplied or incorrect server configuration if things are working properly.

Assuming that the above gives you the expected message, I think I now know what is going wrong. This goes back to the 'Use slash arguments' setting. I think I need to add support for this setting into the coursefilearea repository and repo file manager, since the course files area serves out files in the same way as the internal repositories, it will probably need the same fix to work properly on your server.

Can you do one final test, if you attempt to view a file through the repo file manager and then re-write the URL from something like:

http://myhost.org/repository/coursefilearea/file.php/2/img.jpg

to 

http://myhost.org/repository/coursefilearea/file.php?file=/2/img.jpg

If that works then i'll see if I can write a proper fix into the code for the next full release.

Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Friday, 10 June 2011, 7:37 PM
 
You are correct on both. I got the error message as described and changing the URL showed the slide.
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Monday, 13 June 2011, 5:01 PM
 
I've just put out a set of new releases for Moodle 2.x which should now correctly support your server set up. Can you let me know how you get on?
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Monday, 13 June 2011, 5:24 PM
 
Most definitely. Thanks Tim!

I'm still getting the same results. However, I don't know if this is a difference between 2.0.2 and 2.0.3+, but things seem to be working now for Autoview and everything else at this point, if I leave the "Use slash arguments" unchecked. I'm going to do some more testing leaving them off, however, I am happy to keep trying/testing Autoview with them on if that will be of any help to you. Also, I may run across whatever it was that wouldn't work before and have to switch back again anyway.
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0
by Tim Williams - Monday, 13 June 2011, 6:10 PM
 

"Use Slash Arguments" is going to need to stay off with your server set up, so there is no need to do any further testing with this switched on.

I suspect the underlying reason ties in to the fact that you have to have a php.ini file in every directory. When the browser requests the file:

http://mymoodle.org/repository/coursefilearea/file.php/2/myfile.html

I suspect your server is then trying to find a php.ini file in a corresponding local path, eg:

/path/to/moodle/repository/coursefilearea/file.php/2/

Which of course doesn't exist and never will, so the database access fails. Internal Moodle files are served in a very similar way from a different php script, so will probably fail for the same reason.

Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Monday, 13 June 2011, 6:27 PM
 
In doing a little more research, I have (re)discovered the problem. SCORM does not work with slash arguments disabled. I will try the fix I have found on Moodle's forums, but I have a feeling it may not work. I'll update you when I know.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0
by Mark Davis - Thursday, 16 June 2011, 7:11 PM
 
In doing more testing, unfortunately it still does not work.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Wednesday, 29 June 2011, 8:43 PM
 
Hello again Tim,

I have a different error now, not related to slash arguments. In playing with my existing AutoView Activity, I neglected trying to create a new one. The following error appears whenever I try to create a new Autoview Activity (with the 6-13 release):

Error writing to database

More information about this error

Debug info: Column 'storage' cannot be null
INSERT INTO mdl_autoview (name,timemodified,course,content,summary,noframe,storage,configfile) VALUES(?,?,?,?,?,?,?,?)
[array (
0 => 'Audio Only - Session 1 Part 1',
1 => 1309376203,
2 => '2',
3 => 'Audio Only - Session 1 Part 1',
4 => '<p>Audio Only - Session 1 Part 1</p>',
5 => 0,
6 => NULL,
7 => 'Audio_Only_-_Session_1_Part_1/config.avx',
)]
Stack trace:
  • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 878 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 920 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 45 of /mod/autoview/lib2.php: call to mysqli_native_moodle_database->insert_record()
  • line 67 of /mod/autoview/lib.php: call to autoview_insertrecord()
  • line 410 of /course/modedit.php: call to autoview_add_instance()


Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Thursday, 30 June 2011, 4:24 PM
 
I have put the following temporary fix into lib.php at line 48 that seems to get around this issue for the moment:

if (is_null($CFG->autoview_storage_type))
$mainrecord->storage="";

Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0 - New Issue
by Tim Williams - Tuesday, 5 July 2011, 12:16 PM
 

You can comment out

$mainrecord->storage=$CFG->autoview_storage_type;

it's for a new feature which isn't finished yet. Leaving active didn't cause a problem on my test server, but that obviously isn't the case for everybody so i'll put out a new release with a fix shortly.

Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Tuesday, 5 July 2011, 3:36 PM
 
OK, thanks Tim!
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Thursday, 30 June 2011, 8:29 PM
 
One more thing I've found, Java Audio does not seem to work either.
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0 - New Issue
by Tim Williams - Tuesday, 5 July 2011, 11:58 AM
 
What type of audio file are you using? This option only works with ogg/vorbis files and has very limited capabilities.
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Tuesday, 5 July 2011, 3:36 PM
 
I was using an MP3. That explains things. I'm not that concerned with the capabilities. I re-encode the audio as ogg/vorbis then and give it a whirl, unless one of the other formats will play audio only as well. The problem I'm running across is that the only player I could get to work with an MP3 file is QuickTime, but it wants to download the entire file before it begins to play it. If the Java audio player does the same thing, then I would still want something different. Is there a format (or a fix for the way I am creating MP3s) that would allow them to start streaming instantly, instead of waiting for the entire file to download?
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0 - New Issue
by Tim Williams - Tuesday, 5 July 2011, 5:16 PM
 
The Java Audio player should play the file as it downloads.

My usual approach to audio only is to create an MP4 or FLV file from the audio (usually with a video track showing the text 'Audio Only') and then use it with one of the regular video plugins. I've never found MP3 to be a very satisfactory solution for reasons you have already discovered.

The flash plugin is supposed to be able to play MP3's, but the Flowplayer 3 flash applet used in AutoView doesn't seem to be able to cope with the MP3's i've tried with it. (Note: The audio plugin for Flowplayer 3 isn't currently included with AutoView, so it won't work at all right now).

If you switch AutoView to use FlowPlayer version 1, then MP3 will work with Flash, but you won't get the ability to move backwards/forwards in the stream until the whole file has downloaded. You can switch to FlowPlayer 1 by putting the following into the JavaScript calls box on the config page:

setFlowPlayerVersion(1);
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Tuesday, 5 July 2011, 8:24 PM
 
Thanks Tim.

I've been avoiding using Flash as much as possible because we want to be able to support the iPhone.
Picture of Tim Williams
Re: Autoview Preview for Moodle 2.0 - New Issue
by Tim Williams - Monday, 11 July 2011, 10:58 AM
 
HTML 5 video/audio may well be your solution. There is also no reason why you shouldn't have more than one video source in each presentation. My recommendation would be to have both a Flash and HTML 5 video source pointing at the same underlying MP3 file. That should give you maximum client compatibility.

The HTML 5 video/audio support is going to be improved in the next AutoView release, the current version won't recognise MP3's, but the next release will. The HTML 5 options are currently disabled by default, but you can enable them by following the instructions here:

http://autoview.autotrain.org/mod/data/view.php?d=1&rid=55&filter=1
Picture of Mark Davis
Re: Autoview Preview for Moodle 2.0 - New Issue
by Mark Davis - Monday, 11 July 2011, 2:36 PM
 
That's good news Tim (re: the improvements coming). I had already enabled HTML 5 which was how I was avoiding Flash. But having more than one video source is new (good) news too! Thanks.