Moodle

filelib.php enhancment to support ogv (theora) mime type [PATCH]

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.5
  • Fix Version/s: 1.9.10, 2.0
  • Component/s: Filters, Libraries
  • Labels:
    None
  • Environment:
    Linux Server, Apache 2.2, PHP 5.2, Postgres DB
  • Database:
    Any
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

Currently, any Ogg/Theora video that is uploaded to Moodle has an unset mime type when downloaded. A simple one-line patch sets the correct mime type on the Ogg/Theora video (files that end in .ogv). This allows those videos to automatically play when viewed by a browser like Firefox 3.5+ that supports Open Video. Furthermore, without this correct mime type, Open Video isn't even possible for those (like me) that are willing to hand code the HTML in, for instance, a web page resource to use the <video> tag and .ogv videos.

After applying the above patch, custom HTML inserted into a new resource -> web page, like:

<video height="480" width="640" tabindex="0" poster="/file.php/1351/MyVideo.jpg" controls="true">
<source src="/file.php/1351/MyVideo.ogv" type="video/ogg" />
<source src="/file.php/1351/MyVideo.mp4" type="video/mp4" />
</video>

Works just fine in Firefox 3.5+, without the patch, Firefox fails to view the video in its built in player.

  1. MDL-19927_v19.patch
    19/May/10 6:58 PM
    0.7 kB
    Rossiani Wijaya
  2. MDL-19927_v20.patch
    20/May/10 2:10 PM
    0.7 kB
    Rossiani Wijaya
  3. ogv.patch
    25/Jul/09 5:10 AM
    0.8 kB
    Paul Ortman

Issue Links

Activity

Hide
Alan Trick added a comment -

This is an issue for me too. I'm trying to write a resource module for displaying video files using HTML 5 and Cortado.

By the way, the Xiphi wiki has a run-down of all the standard media mime-types (http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions), some of them are rather obscure, but it would be good to at least support .ogg, .ogv, .oga, .ogx, and .flac.

Show
Alan Trick added a comment - This is an issue for me too. I'm trying to write a resource module for displaying video files using HTML 5 and Cortado. By the way, the Xiphi wiki has a run-down of all the standard media mime-types (http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions), some of them are rather obscure, but it would be good to at least support .ogg, .ogv, .oga, .ogx, and .flac.
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Rossiani,

could you take a look to this, adding the most common mime types and testing them under Moodle 1.9 and 2.0 ?

TIA and ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Rossiani, could you take a look to this, adding the most common mime types and testing them under Moodle 1.9 and 2.0 ? TIA and ciao
Hide
Rossiani Wijaya added a comment -

Thanks Paul for the patch.

In addition to Paul's patch, I added .ogg mime type to 1.9 filelib.php (attach patch)

In 1.9, these two file extensions can be embedded by using object tag in custom html page.

Eloy, I'm not unable to embed the flac file on custom html page. Therefore, I didn't add the flac mime type to the filelib.

Still running some tests with embedding these video files in 2.0. I will post the patch for 2.0 as soon as I get it to works.

Show
Rossiani Wijaya added a comment - Thanks Paul for the patch. In addition to Paul's patch, I added .ogg mime type to 1.9 filelib.php (attach patch) In 1.9, these two file extensions can be embedded by using object tag in custom html page. Eloy, I'm not unable to embed the flac file on custom html page. Therefore, I didn't add the flac mime type to the filelib. Still running some tests with embedding these video files in 2.0. I will post the patch for 2.0 as soon as I get it to works.
Hide
Rossiani Wijaya added a comment -

patch for 2.0

Show
Rossiani Wijaya added a comment - patch for 2.0
Hide
Rossiani Wijaya added a comment -

Added new plugins to support ogv and ogg files.

Commit patch to 2.0 distribution.

Show
Rossiani Wijaya added a comment - Added new plugins to support ogv and ogg files. Commit patch to 2.0 distribution.
Hide
Rossiani Wijaya added a comment -

Added ogg and ogv plugins to 1.9 stable.

All files are checked-in.

Show
Rossiani Wijaya added a comment - Added ogg and ogv plugins to 1.9 stable. All files are checked-in.

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: