The EnxRoom.startStreaming() method allows the Moderator to forward live Video Sessions over RTMP Stream to any live streaming CDNs supporting this protocol. The EnxRoom.stopStreaming() method is used to stop forwarding RTMP Stream.

Class: EnxRoom

Methods:

  • public void startStreaming(JSONObject streamingDetails)
  • public void stopStreaming(JSONObject streamingDetails)  

Parameters:

  • streamingDetails – Configuration options JSON object for forwarding streams.
    • rtmpDetails.rtmpUrl – Use “RTM-URL/RTMP-KEY” from CDN Provider
    • rtmpDetails.urlDetails.url – Optional RTMP Streaming View URL. If not given, a default Streaming View will be applied.

Callbacks:

  • onAckStartStreaming – Acknowledgment to the Moderator when RTMP Streaming starts.
  • onAckStopStreaming – Acknowledgment to the Moderator when RTMP Streaming starts.
  • onStreamingNotification – Notification to all the Participants in the Room when RTMP Streaming starts/stops.
JSONObject jsonObject = new JSONObject();

JSONObject rtmpDetails = new JSONObject();
rtmpDetails.put("rtmpUrl", "RTMP_URL/RTMP_KEY"");
jsonObject.put("rtmpDetails", rtmpDetails);

/* Optional Streaming View URL */
JSONObject urlDetails = new JSONObject();
urlDetails.put("url", "URL-TO-USE-AS-STREAMING-VIEW");
jsonObject.put("urlDetails", urlDetails);

room.startStreaming(jsonObject); // Start Streaming
room.Moderator (jsonObject);     // Stop Streaming

public void onAckStartStreaming(JSONObject jsonObject){
	 // Acknowledges that Streaming Started
}

public void onAckStopStreaming(JSONObject jsonObject){
	 // Acknowledges that Streaming Stopped
}

public void onStreamingNotification(JSONObject jsonObject){
	 // Notifies all that Streaming Started/Stopped
}

Error Codes & Exceptions

CodeDescription
5121Repeated startStreaming() call while the previous request is in process.
5122Repeated startStreaming() call after Streaming has started.
5123Repeated stopStreaming() call while the previous request is in process.
5124stopStreaming() called without starting a Stream first. Non-Contextual Method Call.
5125Invalid Stream configuration.