2012-08-23 79 views
0

我想開發Flash插件,它將在播放器上打印一些文本。我的問題是如何做到這一點?我的意思是有沒有什麼功能可以在播放器上放置一些文字?JWPlayer插件

回答

0

上添加文字有沒有內置函數來顯示文本的其他方式對於球員來說,但是你自己應該很容易做到。

首先,這裏是JWPlayer的documentation用於創建Flash插件。

然後你想要做的是添加一個精靈和文本字段到插件的顯示。

首先,您需要在.as文件的開頭導入相關的Flash類。

import flash.text.TextField 
import flash.text.TextFormat; 
import flash.display.Sprite;  

然後你想要創建一個Sprite和一個TextField。將TextField放入Sprite中,將Sprite放入播放器的顯示控件中。

var textHolderSprite:Sprite = new Sprite(); 
var displayText:TextField = new TextField(); 

displayText.width = 200; // set size of your text field 
displayText.height = 300; 
displayText.x = 50;//and position it. 
displayText.y = 100; 

displayText.text = "hello world";//set the text you want to display. 
displayText.wordWrap = true; // wrap text if you want to. 
displayText.selectable = false; //probably want to make it not selectable. 
displayText.textColor = 0xFFFFFF; //set the text colour; 

//bonus: set font size and alignment; look at TextFormat documentation for more options. 
var displayTextFormat:TextFormat = new TextFormat(); 
displayTextFormat.size = "17";   
displayTextFormat.align = "center"; 
displayText.setTextFormat(displayTextFormat); 

//put the TextField inside the sprite. 
textHolderSprite.addChild(displayText); 

//the following api object, is a com.longtailvideo.jwplayer.player.IPlayer object, as described in the JWPlayer plugin documentation. 
var displayControl:MovieClip = (api.controls.display as MovieClip); //get the player's display control. 
displayControl.addChild(textHolderSprite);//add youre sprite. 

//When you're done with the text, don't forget to remove the sprite. 
displayControl.removeChild(textHolderSprite); 

祝你好運!

0

JWPlayer支持SRT文件(字幕),這樣你就可以創建這個文件把文字上的視頻,如果你需要這些文本生成,你可以將它也許使用PHP,然後給輸出網址

做你可以找到更多的信息,如何在自己的官方網站上添加字幕

可以只使用CSS和JavaScript的組合,將錄像機容器