forked from mediaelement/mediaelement
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mediaelement#660 from markomarkovic/feature-postroll
Feature postroll
- Loading branch information
Showing
13 changed files
with
192 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="postroll"> | ||
<h3>Postroll content</h3> | ||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>HTML5 MediaElement</title> | ||
|
||
|
||
<script src="../build/jquery.js"></script> | ||
<script src="../build/mediaelement-and-player.min.js"></script> | ||
<link rel="stylesheet" href="../build/mediaelementplayer.min.css" /> | ||
</head> | ||
<body> | ||
|
||
<h1>MediaElementPlayer.js</h1> | ||
|
||
<p>Recommended Setup</p> | ||
|
||
|
||
<h2>MP4/WebM video</h2> | ||
<video width="360" height="203" id="player2" controls="controls"> | ||
<source src="../media/echo-hereweare.mp4" type="video/mp4" title="mp4"> | ||
<source src="../media/echo-hereweare.webm" type="video/webm" title="webm"> | ||
<source src="../media/echo-hereweare.ogv" type="video/ogg" title="ogg"> | ||
<p>Your browser leaves much to be desired.</p> | ||
|
||
<link rel="postroll" href="./mediaelementplayer-postroll-content.html" /> | ||
</video> | ||
|
||
<script> | ||
$('audio,video').mediaelementplayer({ | ||
features: ['playpause','progress','volume','postroll'] | ||
}); | ||
</script> | ||
<style> | ||
.postroll { | ||
padding: 5%; | ||
color: #fff; | ||
} | ||
</style> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Postroll plugin | ||
*/ | ||
(function($) { | ||
|
||
$.extend(mejs.MepDefaults, { | ||
postrollCloseText: mejs.i18n.t('Close') | ||
}); | ||
|
||
// Postroll | ||
$.extend(MediaElementPlayer.prototype, { | ||
buildpostroll: function(player, controls, layers, media) { | ||
var | ||
t = this, | ||
postrollLink = t.container.find('link[rel="postroll"]').attr('href'); | ||
|
||
if (typeof postrollLink !== 'undefined') { | ||
player.postroll = | ||
$('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">' + t.options.postrollCloseText + '</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(layers).hide(); | ||
|
||
t.media.addEventListener('ended', function (e) { | ||
$.ajax({ | ||
dataType: 'html', | ||
url: postrollLink, | ||
success: function (data, textStatus) { | ||
layers.find('.mejs-postroll-layer-content').html(data); | ||
} | ||
}); | ||
player.postroll.show(); | ||
}, false); | ||
} | ||
} | ||
}); | ||
|
||
})(mejs.$); |