Skip to content

Commit

Permalink
Support for 'outline' (text outline through glow) design in video player
Browse files Browse the repository at this point in the history
  • Loading branch information
steffentchr committed Mar 6, 2011
1 parent cff8ef8 commit e42960b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/com/PlayerSubtitles.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
import com.adobe.serialization.json.JSONParseError;
private var subtitleTimer:Timer = new Timer(100);
private var subtitles:Array;
// Outline filter
private var outlineFilter:GlowFilter = null;
private function loadSubtitles():void{
if(!_localeObject.href)return;
clearSubtitles();
Expand All @@ -74,6 +77,16 @@
}
private function displaySubtitles(e:Event):void{
if(!subtitles.length || !_targetVideo.playing) return;
// Possibly prepare glow filter for outlining subtitles
if(design!=='bars' && !outlineFilter) {
outlineFilter = new GlowFilter;
outlineFilter.color = 0x000000;
outlineFilter.alpha = 1;
outlineFilter.blurX = 3;
outlineFilter.blurY = 3;
}
var playheadTime:Number = _targetVideo.playheadTime + this.parentApplication.activeElement.getNumber('start') + 0.05;
for (var i:Object in subtitles) {
if(subtitles[i].timestamp_begin<=playheadTime && subtitles[i].timestamp_end>=playheadTime) {
Expand All @@ -92,6 +105,8 @@
if (design==='bars') {
h.setStyle('backgroundColor', 'black');
h.setStyle('backgroundAlpha', 0.8);
} else {
l.filters = [outlineFilter];
}
}
break;
Expand Down

0 comments on commit e42960b

Please sign in to comment.