Multimedia Filter Support For .WMA Files

Multimedia Filter Support For .WMA Files

by Martin Mueller -
Number of replies: 1

Hi

I added the following lines to /filter/mediaplugin/filter.php to enable embedded use of .wma audio files.

Is there any other idea?

Greetings from Switzerland - Martin

if (empty($CFG->filter_mediaplugin_ignore_wma)) {
$search = '/<a(.*?)href=\"([^<]+)\.wma\"([^>]*)>(.*?)<\/a>/i';
$replace = '\\0<p class="mediaplugin wmv"><object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
$replace .= ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
$replace .= ' standby="Loading Microsoft® Windows® Media Player components..." ';
$replace .= ' id="msplayer" type="application/x-oleobject">';
$replace .= "<param name=\"Filename\" value=\"\\2.wma\" />";
$replace .= '<param name="ShowControls" value="true" />';
$replace .= '<param name="AutoRewind" value="true" />';
$replace .= '<param name="AutoStart" value="false" />';
$replace .= '<param name="Autosize" value="true" />';
$replace .= '<param name="EnableContextMenu" value="true" />';
$replace .= '<param name="TransparentAtStart" value="false" />';
$replace .= '<param name="AnimationAtStart" value="false" />';
$replace .= '<param name="ShowGotoBar" value="false" />';
$replace .= '<param name="EnableFullScreenControls" value="true" />';
$replace .= "\n<embed src=\"\\2.wma\" name=\"msplayer\" type=\"video/x-ms\" ";
$replace .= ' ShowControls="1" AutoRewind="1" AutoStart="0" Autosize="0" EnableContextMenu="1"';
$replace .= ' TransparentAtStart="0" AnimationAtStart="0" ShowGotoBar="0" EnableFullScreenControls="1"';
$replace .= ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">';
$replace .= '</embed>';
$replace .= '</object></p>';
$text = preg_replace($search, $replace, $text);
}

Average of ratings: -
In reply to Martin Mueller

Re: Multimedia Filter Support For .WMA Files

by Steve Power -

Martin

Thank you for this. I used it as the basis to add wma to the filter list in my Moodle 1.6 setup.

I had to change:        if (empty($CFG->filter_mediaplugin_ignore_wma)) {
to                            if ($CFG->filter_mediaplugin_enable_wma) {
and to change the defaultsettings.php and filterconfig.html files as well.

For any one else searching the changes were:
to defaultsettings.php I added

    if (!isset($CFG->filter_mediaplugin_enable_wma) or $forcereset) {
        if (isset($CFG->filter_mediaplugin_ignore_wma)) {
            set_config( 'filter_mediaplugin_enable_wma', !$CFG->filter_mediaplugin_ignore_wma );
            set_config( 'filter_mediaplugin_ignore_wma', '' );
        }
        else {
            set_config( 'filter_mediaplugin_enable_wmv', 1 );
        }
    }

and to to filterconfig I added

$txt->mediapluginwma = get_string( 'mediapluginwma','admin' );
and
<tr valign="top">
<td align="right"><?php echo $txt->mediapluginwma ?></td>
<td><?php choose_from_menu( $yesno,'filter_mediaplugin_enable_wma',
$CFG->filter_mediaplugin_enable_wma ); ?></td>
</tr>

Both entries were added under the wmv equivalent entries. Finally I had to add text to the admin.php language file for 'mediapluginwma'

Regards
Steve