我正在尝试创建一个JW播放器插件,源代码的一部分如下所示:
public function initPlugin(player:IPlayer, config:PluginConfig):void {
api = player;
var streamUrl:String = 'xxx';
var streamSecret:String = 'xxx';
var xid:String = config['xid'];
var request:URLRequest = new URLRequest("xxx"+xid);
request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);
var fileName:String, drive:String, userFolder:String, t_hex:String, linkType:String
function completeHandler(evt:Event) {
linkType = evt.target.data.linkType;
fileName = evt.target.data.filename;
drive = evt.target.data.drive;
userFolder = evt.target.data.userFolder;
t_hex = evt.target.data.t_hex;
if (linkType == "1")
{
/*
PHP will generate these variables for the plugin.
fileName, drive, userFolder, t_hex
*/
var relPath:String = "/"+drive+"/"+userFolder+"/"+fileName;
var md5Hash = MD5.encrypt (streamSecret+relPath+t_hex);
var link:String = streamUrl+md5Hash+"/"+t_hex+relPath;
} else
{
}
api.load('http://music-stream.burst-dev.com/test.flv');
api.play();
}
我目前仍然坚持让api.load('')实际加载文件。我已经通过anthropod进行了测试,并且添加的变量是正常的,并且链接生成完美。
我认为我的错误是试图通过函数completeHandler访问api = player,但它无法实现。有人有任何想法吗?
答案 0 :(得分:0)