Wowza Community

Remote server module method calling from javascript

Hello and good time of day.

Got it (remote server module method calling) to work with flash.

But is this possible to work with RMI from JavaScript (and HTML5 players).

Thanks in advance.

Hi Eliont,

Can you provide more details on your user requirements? Some remote calls may be possible by executing REST API calls, which can be done from JavaScript as a simple HTTP request.

Michelle

Thanks, i check it.

What is done:

Client:

			private function send_metadata():void {
				
				var JSONMetadata:Object = new Object();
				
				JSONMetadata.txt = 'Metadata';
				
				NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
				
				var nc:NetConnection = new NetConnection();   
				nc.connect("rtmp://localhost:1935/live");
				nc.call("injectEvent", null, "video", JSONMetadata);
			}

Wowza:

	public void injectEvent(IClient client, RequestFunction function,
			AMFDataList params) {
		String streamname = params.getString(PARAM1);
		AMFDataObj question = params.getObject(PARAM2);
	
		IMediaStream stream = client.getAppInstance().getStreams()
			.getStream(streamname);
		if(stream != null) {
			getLogger().info("event injected into " + streamname);
			stream.sendDirect("question", question);
		} else
			getLogger().info("stream " + streamname + " wasn't found to inject into");
	}

Client:

                vid.attachNetStream(ns);
                //Handle onMetaData and onCuePoint event callbacks: solution at http://tinyurl.com/mkadas
                //See another solution at http://www.adobe.com/devnet/flash/quickstart/metadata_cue_points/
                var infoClient:Object = new Object();
                infoClient.onMetaData = function oMD():void { };
                infoClient.onCuePoint = function oCP():void { };   
				
                infoClient.question = function question(data:Object):void
				{
					Alert.show(data.txt);
				};   
				
                ns.client = infoClient; 

What is needed: do something alike with HTML5 player.

What is needed: do something alike with HTML5 player.

Any suggestions?