Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Commit

Permalink
Fixed title so it works in fullscreen and on top of white videos
Browse files Browse the repository at this point in the history
  • Loading branch information
phuongdh committed Dec 18, 2013
1 parent e43a0c6 commit a2e67d2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
16 changes: 12 additions & 4 deletions app/assets/javascripts/mediaelement-title/mep-feature-title.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
(function($) {
$.extend(mejs.MepDefaults, {
title: null,
titleLink: null
title: null,
titleLink: null
});

$.extend(MediaElementPlayer.prototype, {
buildtitle: function(player, controls, layers, media) {
buildtitle: function(player, controls, layers, media) {
if (player.isVideo && player.options.title != null ) {
$('<div class="mejs-overlay mejs-overlay-title"><a href="' + player.options.titleLink + '">' + player.options.title + '</a></div>').appendTo(layers)
title = $('<div class="mejs-title"><a href="' + player.options.titleLink + '">' + player.options.title + '</a></div>');
title.insertAfter(layers);
media.addEventListener('play',function() {
title.hide();
}, false);
media.addEventListener('pause',function() {
title.show();
}, false);
}
}
});
})(mejs.$);

29 changes: 15 additions & 14 deletions app/assets/stylesheets/mediaelement-title/mejs-title.css.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.mejs-overlay-title {
width: 100%;
z-index: 999;
}

.mejs-overlay-title a {
color: white;
display: block;
font-weight: bold;
font-size: 15pt;
margin: 10px 15px;
text-shadow: 0px 0px 2px rgb(0, 0, 0);
}

.mejs-title {
width: 100%;
z-index: 999;
position: absolute;
top: 0;
left: 0;
background: rgba(35, 35, 38, 0.8);
}

.mejs-title a {
color: white;
display: block;
font-size: 12pt;
margin: 10px 15px;
}

0 comments on commit a2e67d2

Please sign in to comment.