Thanks a lot Maxim. I need two connections because one is going to be used to capture and store audio from the personal computer's microphone and the second one is to capture and record the screen. My understanding is that one connection for both will not work. Is that correct? I see that Openmeetings uses two connections to capture and record audio and screen. Please advise,
Thanks, On Wed, Jun 14, 2017 at 1:48 AM, Maxim Solodovnik <[email protected]> wrote: > Hello Sonia, > > why do you need second connection? > > to create connection you need to > 1) create instance of red5 client: [1] > 2) call "connect" method on this instance: [2] > > [1] > https://github.com/apache/openmeetings/blob/master/ > openmeetings-screenshare/src/main/java/org/apache/ > openmeetings/screenshare/Core.java#L169 > [2] > https://github.com/apache/openmeetings/blob/master/ > openmeetings-screenshare/src/main/java/org/apache/ > openmeetings/screenshare/Core.java#L313 > > > On Tue, Jun 13, 2017 at 2:44 AM, Sonia SWEngineer < > [email protected]> > wrote: > > > I am using Openmeetings ScreenShare code to implement a client java > program > > that captures and streams audio and the screen. The main class is below. > > Want to request advice for this class. After the first connection is > > requested what is a good way to request the second connection in order to > > properly handle the connection delay and the saving of the client > > information. > > > > Thanks a lot, > > > > Main class: > > > > package com.test.test; > > > > import java.net.URI; > > import java.util.Map; > > > > import org.red5.client.net.rtmp.RTMPClient; > > import org.red5.io.utils.ObjectMap; > > import org.red5.server.api.IConnection; > > import org.red5.server.api.Red5; > > import org.red5.server.net.rtmp.Channel; > > import org.red5.server.net.rtmp.RTMPConnection; > > import org.red5.server.net.rtmp.event.Invoke; > > import org.red5.server.service.PendingCall; > > > > import com.test.screenshare.Core; > > import com.test.screenshare.RTMPSScreenShare; > > import com.test.screenshare.RTMPScreenShare; > > import com.test.screenshare.RTMPTSScreenShare; > > import com.test.screenshare.RTMPTScreenShare; > > > > public class Main { > > > > public static void main(String[] args) { > > try { > > > > String[] arg = new String[11]; > > arg[0] = "rtmp://localhost:1935/samplecode/7"; > > arg[1] = "123"; > > arg[2] = "Sample Program;Click Start to publish your screen;Start > > sharing;Pause sharing;Select your screen area:;Change width;Change > > height;X-Offset;Y-Offset;Width:;Height:;Connection was closed by > > server;Show mouse position to viewers;Recording;You may record and share > > your screen at the same time. To enable others to see your screen just > hit > > the start button on the top.;Start recording;Stop recording;Close;Quality > > of the screen share:;Very high quality;High quality;Medium quality;Low > > quality;Publish;Start Publish;Stop Publish;Host;Publish App;Publish > > Id;Reduce the width of the SharingScreen before you try to move it > > left;Reduce the height of the SharingScreen before you try to move it > > bottom;Reduce the x of the SharingScreen before you try to make it > > wider;Reduce the y of the SharingScreen before you try to make it > > higher;Fill these settings stream your screen data to 3th party providers > > like justin.tv;Please start Screen sharing to be able to publish > > it;Moderator permission required to start recording;Notify on > > disconnect;Security;Allow Remote Control (during screen sharing)"; > > arg[3] = "1"; > > arg[4] = "10"; > > arg[5] = "true"; > > arg[6] = "false"; > > arg[7] = "true"; > > arg[8] = "false"; > > arg[9] = "--dummy--"; > > arg[10] = "--dummy--"; > > // Audio Connection > > > > arg[5] = "false"; > > > > Core coreAudioShare = new Core(arg, true); > > while (coreAudioShare.getAudioInstance().getConnection() == null) > > Thread.sleep(100L); > > IConnection current = coreAudioShare.getAudioInstance().getConnection(); > > while (current.getClient() == null) > > Thread.sleep(100L); > > > > // Screen Connection > > arg[1] = (String)current.getClient().getAttribute("parentSid"); > > arg[5] = "true"; > > Core coreScreenShare = new Core(arg); > > > > > > > > } catch (Exception e) { > > System.out.println("Error: " + e.getMessage()); > > } > > > > } > > > > > > -- > WBR > Maxim aka solomax >
