I believe

$settings = array('mediaelement' => array(
  '.class-name' => array(
    'controls' => TRUE,
    'opts' => array(), // This is the mediaelement scripts options.
  );
));
drupal_add_js($settings, 'setting');

should be

	$settings = array(
		'mediaelement' => array(
		'.class-name' => array(
			'controls' => TRUE,
			'opts' => array(), // This is the mediaelement scripts options.
		)
	));
	drupal_add_js($settings, 'setting');

Otherwise you'll get a php error:
Parse error: syntax error, unexpected ';', expecting ')' in /.../sites/all/themes/abc/template.php on line 122

CommentFileSizeAuthor
#1 mediaelement-readme.patch339 byteslyricnz

Comments

s.daniel’s picture

Issue summary: View changes

removed theme name

lyricnz’s picture

Status: Active » Needs review
StatusFileSize
new339 bytes

Semi-colon removing patch attached.

mgifford’s picture

I can verify that. This simple patch fixes the php error I ran into as well. I wonder though if it might make more sense to expand the documentation a bit in the README.txt file.

You shouldn't have to do this step if you've checked the "Enable MediaElement.js site wide" box here /admin/config/media/mediaelement

Without enabling that you'd need to paste PHP code into a node like this:

<?php 
  drupal_add_library('mediaelement', 'mediaelement');
  drupal_add_js(drupal_get_path('module', 'mediaelement') . '/mediaelement.js'); 
  // $settings = array('mediaelement' => array('.class-name' => array('controls' => TRUE, 'opts' => array())));
  $settings = array('mediaelementAll' => TRUE, array('type' => 'setting'));
  drupal_add_js($settings, 'setting');
?>

And then include the video with:

<video width="360" height="203" id="player1" src="/sites/all/libraries/mediaelement/media/echo-hereweare.mp4"><p>Your browser leaves much to be desired.</p></video>

Looking at the http://mediaelementjs.com page though, I'm not sure if this Drupal module already does the work of "Convert all and tags to MediaElement.js using jQuery" or if we also need to add:

<script>
// using jQuery
$('video,audio').mediaelementplayer(/* Options */);
</script>

I'd also like to recommend mentioning http://www.mirovideoconverter.com which can be useful to create the various different video types.

dave reid’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

setting is actually correct.