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:
parent
d74921e1ab
commit
5ff1ce7cba
9 changed files with 83 additions and 33 deletions
|
@ -3,7 +3,7 @@
|
|||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// to query the swf anti cache.
|
||||
function srs_get_version_code() { return "1.20"; }
|
||||
function srs_get_version_code() { return "1.21"; }
|
||||
|
||||
/**
|
||||
* player specified size.
|
||||
|
|
Binary file not shown.
|
@ -132,21 +132,41 @@ package
|
|||
elapTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// get NetConnection NetStatusEvent
|
||||
public function onStatus(evt:NetStatusEvent) : void{
|
||||
trace(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();
|
||||
}
|
||||
|
||||
switch(evt.info.code){
|
||||
|
|
Binary file not shown.
|
@ -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.
|
||||
|
|
Binary file not shown.
|
@ -134,6 +134,25 @@ package
|
|||
flash.external.ExternalInterface.call(this.js_on_publisher_warn, this.js_id, code);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* publish stream to server.
|
||||
* @param url a string indicates the rtmp url to publish.
|
||||
|
@ -187,15 +206,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();
|
||||
}
|
||||
|
||||
if (evt.info.code == "NetConnection.Connect.Closed") {
|
||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// current release version
|
||||
#define VERSION_MAJOR "0"
|
||||
#define VERSION_MINOR "9"
|
||||
#define VERSION_REVISION "117"
|
||||
#define VERSION_REVISION "118"
|
||||
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
|
||||
// server info.
|
||||
#define RTMP_SIG_SRS_KEY "SRS"
|
||||
|
|
|
@ -866,6 +866,8 @@ int SrsRtmpServer::response_connect_app(SrsRequest *req, const char* server_ip)
|
|||
if (server_ip) {
|
||||
data->set("srs_server_ip", SrsAmf0Any::str(server_ip));
|
||||
}
|
||||
// for edge to directly get the id of client.
|
||||
data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id()));
|
||||
|
||||
if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
|
||||
srs_error("send connect app response message failed. ret=%d", ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue