This repository has been archived by the owner on Jan 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed title so it works in fullscreen and on top of white videos
- Loading branch information
Showing
2 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
16 changes: 12 additions & 4 deletions
16
app/assets/javascripts/mediaelement-title/mep-feature-title.js
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 |
---|---|---|
@@ -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
29
app/assets/stylesheets/mediaelement-title/mejs-title.css.erb
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 |
---|---|---|
@@ -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; | ||
} |