use of org.jitsi.impl.neomedia.device.AudioMediaDeviceImpl in project Spark by igniterealtime.
the class AudioReceiverChannel method start.
/**
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
* Starts receive also.
*/
public synchronized String start() {
try {
MediaService mediaService = LibJitsi.getMediaService();
MediaDevice device = mediaService.getDefaultDevice(MediaType.AUDIO, MediaUseCase.CALL);
List<MediaDevice> devices = mediaService.getDevices(MediaType.AUDIO, MediaUseCase.CALL);
for (MediaDevice foundDevice : devices) {
if (foundDevice instanceof AudioMediaDeviceImpl) {
AudioMediaDeviceImpl amdi = (AudioMediaDeviceImpl) foundDevice;
if (inLocator == amdi.getCaptureDeviceInfo().getLocator()) {
System.out.println("Test" + inLocator + "-" + amdi.getCaptureDeviceInfo().getLocator());
device = foundDevice;
}
}
System.out.println(foundDevice.getClass() + "-" + inLocator);
}
mediaStream = mediaService.createMediaStream(device);
mediaStream.setDirection(MediaDirection.RECVONLY);
System.out.println("TEST");
MediaFormat format = mediaService.getFormatFactory().createMediaFormat("PCMA", 8000);
mediaStream.setFormat(format);
StreamConnector connector = new DefaultStreamConnector(new DatagramSocket(this.localPort), new DatagramSocket(this.localPort + 1));
mediaStream.setConnector(connector);
mediaStream.setTarget(new MediaStreamTarget(new InetSocketAddress(this.remoteIpAddress, this.remotePort), new InetSocketAddress(this.remoteIpAddress, this.remotePort + 1)));
mediaStream.setName(MediaType.AUDIO.toString());
mediaStream.start();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
use of org.jitsi.impl.neomedia.device.AudioMediaDeviceImpl in project Spark by igniterealtime.
the class AudioChannel method start.
/**
* Starts the transmission. Returns null if transmission started ok.
* Otherwise it returns a string with the reason why the setup failed.
* Starts receive also.
*/
public synchronized String start() {
try {
MediaService mediaService = LibJitsi.getMediaService();
MediaDevice device = null;
List<MediaDevice> devices = mediaService.getDevices(MediaType.AUDIO, MediaUseCase.CALL);
for (MediaDevice foundDevice : devices) {
if (foundDevice instanceof AudioMediaDeviceImpl) {
AudioMediaDeviceImpl amdi = (AudioMediaDeviceImpl) foundDevice;
if (inLocator == amdi.getCaptureDeviceInfo().getLocator()) {
System.out.println("Test" + inLocator + "-" + amdi.getCaptureDeviceInfo().getLocator());
device = foundDevice;
}
}
System.out.println(foundDevice.getClass() + "-" + inLocator);
}
mediaStream = mediaService.createMediaStream(device);
mediaStream.setDirection(MediaDirection.SENDRECV);
mediaStream.setFormat(format);
connector = new DefaultStreamConnector(new DatagramSocket(this.localPort), new DatagramSocket(this.localRTCPPort));
mediaStream.setConnector(connector);
mediaStream.setTarget(new MediaStreamTarget(new InetSocketAddress(this.ipAddress, this.remotePort), new InetSocketAddress(this.ipAddress, this.remoteRTCPPort)));
mediaStream.setName(MediaType.AUDIO.toString());
mediaStream.start();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Aggregations