2012-08-23 5 views
0

플레이어에 텍스트를 인쇄하는 플래시 플러그인을 개발하려고합니다. 내 질문은 그것을하는 방법입니다? 거기에 플레이어에 텍스트를 넣을 함수가 있습니까?JWPlayer Plugin

답변

0

에 텍스트를 추가하기 위해 CSS와 자바 스크립트의 조합을 사용 할 수 있습니다 선수를 위해 그러나 그것은 너 자신에 의하여 아주 쉬운해야한다.

먼저 플래시 플러그인 생성을위한 JWPlayer의 documentation입니다.

그러면 플러그인의 디스플레이에 스프라이트와 텍스트 필드를 추가하기 만하면됩니다.

먼저, .as 파일의 시작 부분에서 관련 플래시 클래스를 가져와야합니다.

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를 사용하고 출력 URL

을 제공 할 수있는, 비디오에 텍스트를 넣어이 파일을 만들 수 있습니다 당신은 자신의 공식 웹 사이트에 자막을 추가하는 방법에 대해 자세한 정보를 찾을 수 있습니다

다른 방법 단지 텍스트를 표시 할 기본 제공 함수가 없습니다 위해 VideoPlayer 컨테이너