JW Player Textmark Plugin
JW Player is a solid video player that is very simple to setup and use. One of my projects in the past required that I add text overlays on top of the Flash videos that were being played. This is not quite the same as a watermark that is burned into the video itself. It is merely a way to add dynamic text on top of the video without needing to re-encode it. I've developed a plugin called Textmark that will allow for text to be overlaid on top of a video. This is not an official plugin, meaning it has not been approved yet by Longtail Video to appear in their AddOns section. Until it's officially approved, I will host it here. There is a zip file attached with a working demo of the Textmark plugin.
You must place your player.swf and jwplayer.js files in the same directory as the demo files or modify the demo.html file and set the paths to these files.
demo.html
<html>
<head>
<title>Textmark Demo</title>
<style>
body { background: #000000; margin: 0px; padding: 0px; }
.overlayUpdater { color: #fff; }
</style>
<script type="text/javascript">
var player = null;
function playerReady(obj)
{player = document.getElementById(obj['id']);
// Set options for ALL overlaysplayer.overlayOption('fontSize', 24);
player.overlayOption('alpha', .5);
player.overlayOption('overlayPadding', 80);
// Create the overlays to place on videoplayer.setOverlay('o1', 'Textmark', 'l,30%');
player.setOverlay('o2', 'Demo', 'r,30%');
player.setOverlay('o3', 'Date', 'l,*33%');
};
</script></head>
<body>
<div id="mediaplayer">JW Player goes here</div>
<a class="overlayUpdater" href="javascript:;" onclick="player.setOverlay('o3', new Date(), 'l,*33%');">Set overlay 3 to current date</a>
<script type="text/javascript" src="jwplayer.js"></script>
<script type="text/javascript">
jwplayer('mediaplayer').setup(
{height: '90%',
width: '100%',
flashplayer: 'player.swf',
file: '<a href="http://content.longtailvideo.com/videos/flvplayer.flv',
">http://content.longtailvideo.com/videos/flvplayer.flv',</a> plugins: 'Textmark.swf'});</script></body></html>
The most important part of this file is the code in the playerReady() function:
// Set options for ALL overlaysplayer.overlayOption('fontSize', 24);
player.overlayOption('alpha', .5);
player.overlayOption('overlayPadding', 80);
// Create the overlays to place on videoplayer.setOverlay('o1', 'Textmark', 'l,30%');
player.setOverlay('o2', 'Demo', 'r,30%');
player.setOverlay('o3', 'Date', 'l,*33%');
The player.setOverlay() is used to create and modify overlays. The function take 3 parameters:
id: The id of the overlay
text: The text that should be displayed in the overlay
alignment: The location of the overlay on the video (x,y), explained below
Alignment Values:
Example: l,t = top left
Example: r,t = top right
Example: m,b = bottom middle
Example: 0,50 = 0px from left, 50px from top
Example: 10%,50% = 10% from left, 50% from top
Example: *10,b = 10px from the right, on the bottom
Example: m,*30% = middle horizontally, 30% from the bottom
You can see an interactive demo of the Textmark plugin here: Textmark Demo
| Attachment | Size |
|---|---|
| 4.93 KB |



Comments
Positionning the text
Sorry, i figured it ou myself
Yes, the padding is in there
Using this on iOS devices?
Right now, the plugin only
Very nice
"individual text overlays
hello, is this available on
I got it to work!!! the only
Can you post the code you're
I just posted an updated
Different font sizes for text
This is not available yet.
It doesn't support Chinese
Good Good Study, Day Day UP
Can you post the code you're
Can it support mp3 audio ?
JWPLAYER 6
SWF source code?
animation
MLR
There is no built-in ability