1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for bug #87, response the server SrsId to flash.

This commit is contained in:
winlin 2014-05-27 15:34:55 +08:00
parent d74921e1ab
commit 5ff1ce7cba
9 changed files with 83 additions and 33 deletions

View file

@ -143,29 +143,17 @@ package
private function system_on_metadata(metadata:Object):void {
this.media_metadata = metadata;
if (metadata.hasOwnProperty("server")) {
// for context menu
var customItems:Array = [new ContextMenuItem("SrsPlayer")];
if (metadata.hasOwnProperty("server")) {
customItems.push(new ContextMenuItem("Server: " + metadata.server));
}
if (metadata.hasOwnProperty("contributor")) {
customItems.push(new ContextMenuItem("Contributor: " + metadata.contributor));
}
contextMenu.customItems = customItems;
}
// for js.
var obj:Object = __get_video_size_object();
obj.server = 'srs';
obj.contributor = 'winlin';
if (metadata.hasOwnProperty("server")) {
obj.server = metadata.server;
if (srs_server != null) {
obj.server = srs_server;
}
if (metadata.hasOwnProperty("contributor")) {
obj.contributor = metadata.contributor;
if (srs_primary_authors != null) {
obj.contributor = srs_primary_authors;
}
var code:int = flash.external.ExternalInterface.call(js_on_player_metadata, js_id, obj);
@ -277,6 +265,25 @@ package
}
}
// srs infos
private var srs_server:String = null;
private var srs_primary_authors:String = null;
private var srs_id:String = null;
private function update_context_items():void {
// for context menu
var customItems:Array = [new ContextMenuItem("SrsPlayer")];
if (srs_server != null) {
customItems.push(new ContextMenuItem("Server: " + srs_server));
}
if (srs_primary_authors != null) {
customItems.push(new ContextMenuItem("PrimaryAuthors: " + srs_primary_authors));
}
if (srs_id != null) {
customItems.push(new ContextMenuItem("SrsId: " + srs_id));
}
contextMenu.customItems = customItems;
}
/**
* function for js to call: to play the stream. stop then play.
* @param url, the rtmp/http url to play.
@ -300,15 +307,16 @@ package
trace ("NetConnection: code=" + evt.info.code);
if (evt.info.hasOwnProperty("data") && evt.info.data) {
// for context menu
var customItems:Array = [new ContextMenuItem("SrsPlayer")];
if (evt.info.data.hasOwnProperty("srs_server")) {
customItems.push(new ContextMenuItem("Server: " + evt.info.data.srs_server));
srs_server = evt.info.data.srs_server;
}
if (evt.info.data.hasOwnProperty("srs_primary_authors")) {
customItems.push(new ContextMenuItem("PrimaryAuthors: " + evt.info.data.srs_primary_authors));
srs_primary_authors = evt.info.data.srs_primary_authors;
}
contextMenu.customItems = customItems;
if (evt.info.data.hasOwnProperty("srs_id")) {
srs_id = evt.info.data.srs_id;
}
update_context_items();
}
// TODO: FIXME: failed event.