Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item14478: fixed initialization of media player
  • Loading branch information
MichaelDaum committed Sep 13, 2017
1 parent 4efc660 commit c3e0682
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
3 changes: 2 additions & 1 deletion data/System/MediaElementPlugin.txt
Expand Up @@ -82,6 +82,7 @@ to render an audio player for your song as part of the page.

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 13 Sep 2017: | only initialized video and audio elements of type =.jqMediaElement= |
| 01 Dec 2016: | upgraded to mediaelement-2.23.4; use Foswiki::Func api to read files (oops) |
| 02 Sep 2016: | updated to latest release of mejs |
| 12 Dec 2014: | initial release |
Expand All @@ -90,7 +91,7 @@ to render an audio player for your song as part of the page.
%META:FILEATTACHMENT{name="Video.png" attachment="MediaElementSnap2.png" attr="" comment="" date="1418394213" size="189478" user="ProjectContributor" version="1"}%
%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Michael Daum"}%
%META:FIELD{name="Copyright" title="Copyright" value="© 2010-2016, John Dyer http://j.hn, © 2014-2016 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Copyright" title="Copyright" value="© 2010-2016, John Dyer http://j.hn, © 2014-2017 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="[[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]]"}%
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/MediaElementPlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# MediaElementPlugin is Copyright (C) 2014-2016 Michael Daum http://michaeldaumconsulting.com
# MediaElementPlugin is Copyright (C) 2014-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -19,8 +19,8 @@ use strict;
use warnings;
use Foswiki::Plugins::JQueryPlugin ();

our $VERSION = '2.01';
our $RELEASE = '01 Dec 2016';
our $VERSION = '2.10';
our $RELEASE = '13 Sep 2017';
our $SHORTDESCRIPTION = "Cross-browser embedding of videos and audios";
our $NO_PREFS_IN_TOPIC = 1;

Expand Down
12 changes: 6 additions & 6 deletions lib/Foswiki/Plugins/MediaElementPlugin/Core.pm
Expand Up @@ -88,7 +88,7 @@ sub handleVIDEO {
url => $url,
mimeType => $mimeType || $this->getMimeType($file),
poster => '%IMAGE{"'.$url.'" frame="'.$frame.'" output="png" width="'.$width.'" '.($height ne 'auto'?'height="'.$height.'"':'').' format="$src" crop="on" '.($rotate?'rotate="'.$rotate.'"':'').' warn="off"}%',
placeholder => '%IMAGE{"'.$url.'" frame="'.$frame.'" output="png" width="'.$width.'" '.($height ne 'auto'?'height="'.$height.'"':'').' title="'.$placeholder.'" type="plain" crop="on"}%',
placeholder => '%IMAGE{"'.$url.'" frame="'.$frame.'" output="png" width="'.$width.'" '.($height ne 'auto'?'height="'.$height.'"':'').' title="'.$placeholder.'" type="plain" crop="on" warn="off"}%',
}
}

Expand All @@ -106,7 +106,7 @@ sub handleVIDEO {

my $skin = $params->{skin} || '';
my $class = '';
$class="class='mejs-$skin" if $skin && $skin ne 'default';
$class="mejs-$skin" if $skin && $skin ne 'default';

my $poster = $params->{poster} || '';
if (!$autoplay && $poster !~ /^(none|off)$/) {
Expand All @@ -122,7 +122,7 @@ sub handleVIDEO {
my $id = $params->{id} || "mej-". (int( rand(10000) ) + 1);

my $result = <<HERE;
<video id="$id" $class $style width="$width" height="$height" $poster $controls $autoplay $preload>
<video id="$id" class="jqMediaElement $class" $style width="$width" height="$height" $poster $controls $autoplay $preload>
$videos
<object width="$width" height="$height" type="application/x-shockwave-flash" data="%PUBURLPATH%/%SYSTEMWEB%/MediaElementPlugin/flashmediaelement.swf">
<param name="movie" value="%PUBURLPATH%/%SYSTEMWEB%/MediaElementPlugin/flashmediaelement.swf" />
Expand All @@ -148,15 +148,15 @@ sub handleAUDIO {
my $skin = $params->{skin} || '';

my $class = '';
$class="class='mejs-$skin" if $skin;
$class="mejs-$skin" if $skin;

my $url = '';
unless ($url =~ /^https?:/i) {
$url = Foswiki::Func::getPubUrlPath() . '/' . $web . '/' . $topic . '/' . $audio;
}

my $result = <<HERE;
<audio $class src="$url" $autoplay $preload></audio>
<audio class="jqMediaElement $class" src="$url" $autoplay $preload></audio>
HERE

return $result;
Expand Down Expand Up @@ -187,7 +187,7 @@ sub getMimeType {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2013-2016 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 2013-2017 Michael Daum http://michaeldaumconsulting.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/MediaElementPlugin/MANIFEST
@@ -1,3 +1,4 @@
!noci
data/System/MediaElementPlugin.txt 0644
lib/Foswiki/Plugins/MediaElementPlugin/Core.pm 0644
lib/Foswiki/Plugins/MediaElementPlugin/DEPENDENCIES 0644
Expand Down
Expand Up @@ -6222,8 +6222,8 @@ if (typeof jQuery != 'undefined') {
// handle clicks to the source radio buttons
.delegate('input[type=radio]', 'click', function() {
// set aria states
$(this).attr('aria-selected', true).attr('checked', 'checked');
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').removeAttr('checked');
$(this).attr('aria-selected', true).prop('checked', true);
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').prop('checked', false);

var src = this.value;

Expand Down Expand Up @@ -6652,4 +6652,4 @@ Marker position and a reference to the MediaElement Player object is passed to t

}
});
})(mejs.$);
})(mejs.$);
Expand Up @@ -2,7 +2,7 @@
jQuery(function($) {
var defaults = {};

$("audio,video").livequery(function() {
$("audio.jqMediaElement, video.jqMediaElement").livequery(function() {
var $this = $(this),
opts = $.extend({}, defaults, $this.data());

Expand Down
Expand Up @@ -3780,8 +3780,8 @@ if (typeof jQuery != 'undefined') {
// handle clicks to the source radio buttons
.delegate('input[type=radio]', 'click', function() {
// set aria states
$(this).attr('aria-selected', true).attr('checked', 'checked');
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').removeAttr('checked');
$(this).attr('aria-selected', true).prop('checked', true);
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').prop('checked', false);

var src = this.value;

Expand Down Expand Up @@ -4210,4 +4210,4 @@ Marker position and a reference to the MediaElement Player object is passed to t

}
});
})(mejs.$);
})(mejs.$);
9 changes: 5 additions & 4 deletions pub/System/MediaElementPlugin/pkg.uncompressed.js
Expand Up @@ -6222,8 +6222,8 @@ if (typeof jQuery != 'undefined') {
// handle clicks to the source radio buttons
.delegate('input[type=radio]', 'click', function() {
// set aria states
$(this).attr('aria-selected', true).attr('checked', 'checked');
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').removeAttr('checked');
$(this).attr('aria-selected', true).prop('checked', true);
$(this).closest('.mejs-sourcechooser-selector').find('input[type=radio]').not(this).attr('aria-selected', 'false').prop('checked', false);

var src = this.value;

Expand Down Expand Up @@ -6652,11 +6652,12 @@ Marker position and a reference to the MediaElement Player object is passed to t

}
});
})(mejs.$);"use strict";
})(mejs.$);
"use strict";
jQuery(function($) {
var defaults = {};

$("audio,video").livequery(function() {
$("audio.jqMediaElement, video.jqMediaElement").livequery(function() {
var $this = $(this),
opts = $.extend({}, defaults, $this.data());

Expand Down

0 comments on commit c3e0682

Please sign in to comment.