本文整理汇总了Java中org.kurento.client.KurentoClient类的典型用法代码示例。如果您正苦于以下问题:Java KurentoClient类的具体用法?Java KurentoClient怎么用?Java KurentoClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KurentoClient类属于org.kurento.client包,在下文中一共展示了KurentoClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateStats
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public synchronized KmsStats updateStats() {
KurentoClient kurentoClient = createKurentoClient(kmsWsUri);
startIteration();
try {
crunchKms(kurentoClient);
} catch (Throwable t) {
clean();
throw new RuntimeException("Unexpected error while updating stats",
t);
} finally {
kurentoClient.destroy();
}
return stopIteration();
}
示例2: PlayMediaPipeline
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public PlayMediaPipeline(KurentoClient kurento, String user, final WebSocketSession session) {
// Media pipeline
pipeline = kurento.createMediaPipeline();
// Media Elements (WebRtcEndpoint, PlayerEndpoint)
webRtc = new WebRtcEndpoint.Builder(pipeline).build();
player = new PlayerEndpoint.Builder(pipeline, RECORDING_PATH + user + RECORDING_EXT).build();
// Connection
player.connect(webRtc);
// Player listeners
player.addErrorListener(new EventListener<ErrorEvent>() {
@Override
public void onEvent(ErrorEvent event) {
log.info("ErrorEvent: {}", event.getDescription());
sendPlayEnd(session);
}
});
}
示例3: CallMediaPipeline
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public CallMediaPipeline(KurentoClient kurento, String from, String to) {
// Media pipeline
pipeline = kurento.createMediaPipeline();
// Media Elements (WebRtcEndpoint, RecorderEndpoint)
webRtcCaller = new WebRtcEndpoint.Builder(pipeline).build();
webRtcCallee = new WebRtcEndpoint.Builder(pipeline).build();
recorderCaller = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + from + RECORDING_EXT)
.build();
recorderCallee = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + to + RECORDING_EXT)
.build();
// Connections
webRtcCaller.connect(webRtcCallee);
webRtcCaller.connect(recorderCaller);
webRtcCallee.connect(webRtcCaller);
webRtcCallee.connect(recorderCallee);
}
示例4: getTestExtraFakeKurento
import org.kurento.client.KurentoClient; //导入依赖的package包/类
protected synchronized KurentoClient getTestExtraFakeKurento() {
if (testExtraFakeKurento == null) {
testExtraFakeKurento = KurentoClient.create(testExtraFakeKmsWsUri,
new KurentoConnectionListener() {
@Override
public void connected() {
}
@Override
public void connectionFailed() {
}
@Override
public void disconnected() {
testExtraFakeKurento = null;
}
@Override
public void reconnected(boolean sameServer) {
}
});
}
return testExtraFakeKurento;
}
示例5: CallMediaPipeline
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public CallMediaPipeline(KurentoClient kurento, String from, String to) {
// Media pipeline
pipeline = kurento.createMediaPipeline();
// Media Elements (WebRtcEndpoint, RecorderEndpoint, FaceOverlayFilter)
webRtcCaller = new WebRtcEndpoint.Builder(pipeline).build();
webRtcCallee = new WebRtcEndpoint.Builder(pipeline).build();
recorderCaller = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + from + RECORDING_EXT)
.build();
recorderCallee = new RecorderEndpoint.Builder(pipeline, RECORDING_PATH + to + RECORDING_EXT)
.build();
String appServerUrl = System.getProperty("app.server.url",
One2OneCallAdvApp.DEFAULT_APP_SERVER_URL);
FaceOverlayFilter faceOverlayFilterCaller = new FaceOverlayFilter.Builder(pipeline).build();
faceOverlayFilterCaller.setOverlayedImage(appServerUrl + "/img/mario-wings.png", -0.35F, -1.2F,
1.6F, 1.6F);
FaceOverlayFilter faceOverlayFilterCallee = new FaceOverlayFilter.Builder(pipeline).build();
faceOverlayFilterCallee.setOverlayedImage(appServerUrl + "/img/Hat.png", -0.2F, -1.35F, 1.5F,
1.5F);
// Connections
webRtcCaller.connect(faceOverlayFilterCaller);
faceOverlayFilterCaller.connect(webRtcCallee);
faceOverlayFilterCaller.connect(recorderCaller);
webRtcCallee.connect(faceOverlayFilterCallee);
faceOverlayFilterCallee.connect(webRtcCaller);
faceOverlayFilterCallee.connect(recorderCallee);
}
示例6: CallMediaPipeline
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public CallMediaPipeline(KurentoClient kurento) {
try {
this.pipeline = kurento.createMediaPipeline();
this.callerWebRtcEp = new WebRtcEndpoint.Builder(pipeline).build();
this.calleeWebRtcEp = new WebRtcEndpoint.Builder(pipeline).build();
this.callerWebRtcEp.connect(this.calleeWebRtcEp);
this.calleeWebRtcEp.connect(this.callerWebRtcEp);
} catch (Throwable t) {
if (this.pipeline != null) {
pipeline.release();
}
}
}
示例7: startSession
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public String startSession(final WebSocketSession session, String sdpOffer) {
// One KurentoClient instance per session (reserving points per session)
Properties properties = new Properties();
properties.add("loadPoints", POINTS_PER_SESSION);
kurentoClient = KurentoClient.create(properties);
log.info("Created kurentoClient (session {})", sessionId);
// Media logic (pipeline and media elements connectivity)
mediaPipeline = kurentoClient.createMediaPipeline();
log.info("Created Media Pipeline {} (session {})", mediaPipeline.getId(), sessionId);
webRtcEndpoint = new WebRtcEndpoint.Builder(mediaPipeline).build();
FaceOverlayFilter faceOverlayFilter = new FaceOverlayFilter.Builder(mediaPipeline).build();
faceOverlayFilter.setOverlayedImage("http://files.kurento.org/img/mario-wings.png", -0.35F,
-1.2F, 1.6F, 1.6F);
webRtcEndpoint.connect(faceOverlayFilter);
faceOverlayFilter.connect(webRtcEndpoint);
// WebRTC negotiation
webRtcEndpoint.addOnIceCandidateListener(new EventListener<OnIceCandidateEvent>() {
@Override
public void onEvent(OnIceCandidateEvent event) {
JsonObject response = new JsonObject();
response.addProperty("id", "iceCandidate");
response.add("candidate", JsonUtils.toJsonObject(event.getCandidate()));
handler.sendMessage(session, new TextMessage(response.toString()));
}
});
String sdpAnswer = webRtcEndpoint.processOffer(sdpOffer);
webRtcEndpoint.gatherCandidates();
return sdpAnswer;
}
示例8: FixedNKmsManager
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public FixedNKmsManager(List<String> kmsWsUri, int kmsLoadLimit) {
for (String uri : kmsWsUri) {
Kms kms = new Kms(KurentoClient.create(uri), uri);
kms.setLoadManager(new MaxWebRtcLoadManager(kmsLoadLimit));
this.addKms(kms);
}
}
示例9: crunchKms
import org.kurento.client.KurentoClient; //导入依赖的package包/类
private void crunchKms(KurentoClient kurentoClient) {
ServerManager serverManager = kurentoClient.getServerManager();
List<MediaPipeline> mediaPipelines = serverManager.getPipelines();
numPipelines.addSample(mediaPipelines.size());
for (MediaPipeline p : mediaPipelines) {
crunchPipeline(p);
}
}
示例10: createKurentoClient
import org.kurento.client.KurentoClient; //导入依赖的package包/类
private KurentoClient createKurentoClient(String kmsWsUri) {
try {
KurentoClient kurentoClient = KurentoClient.create(kmsWsUri);
return kurentoClient;
} catch (Throwable t) {
throw new RuntimeException("Cannot connect to KMS instance in URI "
+ kmsWsUri, t);
}
}
示例11: FixedNKmsManager
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public FixedNKmsManager(List<String> kmsWsUri, int kmsLoadLimit) {
for (String uri : kmsWsUri) {
Kms kms = new Kms(KurentoClient.create(uri), uri);
kms.setLoadManager(new MaxWebRtcLoadManager(kmsLoadLimit));
this.addKms(kms);
}
}
示例12: TestPipeline
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public TestPipeline(KurentoClient kurento, String room, String pipeDescription) {
this.kurento = kurento;
if (room != null) {
this.room = room;
}
if (pipeDescription != null) {
this.description = pipeDescription;
}
}
示例13: newParticipant
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public void newParticipant(String name, String playerUri, boolean autoMedia, boolean loopMedia,
KurentoClient kurento) {
TestPipeline pipeline = getOrCreatePipeline(kurento);
pipeline.createPipeline();
FakeParticipant participant = new FakeParticipant(serviceUrl, name, room, playerUri,
pipeline.getPipeline(), autoMedia, loopMedia);
participants.put(name, participant);
participant.joinRoom();
}
示例14: getOrCreatePipeline
import org.kurento.client.KurentoClient; //导入依赖的package包/类
private TestPipeline getOrCreatePipeline(KurentoClient kurento) {
TestPipeline pipeline = this.pipelines.get(kurento);
if (pipeline == null) {
String desc = kurento.getServerManager().getId();
pipeline = this.pipelines.putIfAbsent(kurento, new TestPipeline(kurento, room, desc));
if (pipeline != null) {
log.debug("Pipeline already created for room '{}' and kurento '{}'", room, desc);
}
pipeline = this.pipelines.get(kurento);
}
return pipeline;
}
示例15: parallelJoinFakeUsers
import org.kurento.client.KurentoClient; //导入依赖的package包/类
public CountDownLatch parallelJoinFakeUsers(final List<String> relativePaths, final String room,
final KurentoClient kurento) {
if (relativePaths == null || relativePaths.isEmpty()) {
execExceptions.put("parallelJoinFakeUsers-" + room, new Exception(
"Null or empty play paths list"));
return null;
}
int userThreads = relativePaths.size();
log.info("Joining room '{}': {} fake users with relative play paths:\n{}", room, userThreads,
relativePaths);
final CountDownLatch joinLatch = new CountDownLatch(userThreads);
parallelTasks(userThreads, USER_FAKE_PREFIX, "parallelJoinFakeUsers-" + room, new Task() {
@Override
public void exec(int numTask) throws Exception {
try {
String userName = getFakeKey(numTask);
FakeSession s = createSession(room);
String fullPlayPath = getPlaySourcePath(userName, relativePaths.get(numTask));
if (kurento == null) {
s.newParticipant(userName, fullPlayPath, true, true);
} else {
s.newParticipant(userName, fullPlayPath, true, true, kurento);
}
} finally {
joinLatch.countDown();
}
}
});
return joinLatch;
}