PlayerEndpoint to WebRtcEndpoint code

347 views
Skip to first unread message

Denis Syroezhkin

unread,
Jan 15, 2015, 7:48:47 AM1/15/15
to kur...@googlegroups.com












Hello! I need help connect PlayerEndpoint to WebRtcEndpoint.

I try this code (java): 
private void start(WebSocketSession session, JsonObject jsonMessage) {
try {
// Media Logic (Media Pipeline and Elements)
MediaPipeline pipeline = kurento.createMediaPipeline();
pipelines.put(session.getId(), pipeline);

//initialization PlayerEndpoint
PlayerEndpoint playerEndpoint = new PlayerEndpoint.Builder(pipeline,
"rtsp://user:pass...@192.168.1.6:554").build();
                        //initialization WebRtcEndpoint
WebRtcEndpoint webRtcEndpoint = new WebRtcEndpoint.Builder(pipeline)
.build();
                        //Connect PlayerEndpoint and WebRtcEndpoint (PlayerEndpoint ---> WebRtcEndpoint)
                        playerEndpoint.connect(webRtcEndpoint);
webRtcEndpoint.connect(playerEndpoint);

                        //Start playback
        String videoUrl = webRtcEndpoint.getUrl();

// SDP negotiation (offer and answer)
String sdpOffer = jsonMessage.get("sdpOffer").getAsString();
String sdpAnswer = playerEndpoint.processOffer(sdpOffer);

// Sending response back to client
JsonObject response = new JsonObject();
response.addProperty("id", "startResponse");
response.addProperty("sdpAnswer", sdpAnswer);
session.sendMessage(new TextMessage(response.toString()));
} catch (Throwable t) {
sendError(session, t.getMessage());
}
}

private void sendError(WebSocketSession session, String message) {
try {
JsonObject response = new JsonObject();
response.addProperty("id", "error");
response.addProperty("message", message);
session.sendMessage(new TextMessage(response.toString()));
} catch (IOException e) {
log.error("Exception sending message", e);
}
}
}


I use MagicMirror Tutorial, It is impossible to connect PlayerEndpoint, I've tried almost all of the examples, and look here http://www.kurento.org/docs/current/langdoc/javadoc/index.html and look here http://www.kurento.org/docs/current/mastering/kurento_architecture.html?highlight=sdp  I watched all the tutorials and documentation, but I can not connect PlayerEndpoint and WebRtcEndpoint. Please help me! Sorry for the stupid questions. But I really need your help!



P.S. Maybe you can give me a link where I should read the information or send immediately ready code (which I doubt) Thanks for the answer!

Ivan Gracia

unread,
Jan 15, 2015, 8:10:46 AM1/15/15
to Kurento Public
Remove webRtcEndpoint.connect(playerEndpoint); since you are creating a loopback

Ivan Gracia



--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Denis Syroezhkin

unread,
Jan 15, 2015, 8:35:10 AM1/15/15
to kur...@googlegroups.com
If I remove 
webRtcEndpoint.connect (playerEndpoint);
the code that will work?

Answer server: 
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Kurento Java Tutorial 2 5.0.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ kurento-magic-mirror ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 11 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ kurento-magic-mirror ---
[INFO] Compiling 1 source file to /home/denis/kurento-tutorial-java/kurento-magic-mirror/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.887s
[INFO] Finished at: Thu Jan 15 18:29:55 YEKT 2015
[INFO] Final Memory: 14M/34M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project kurento-magic-mirror: Compilation failure: Compilation failure:
[ERROR] /home/denis/kurento-tutorial-java/kurento-magic-mirror/src/main/java/org/kurento/tutorial/magicmirror/MagicMirrorHandler.java:[102,3] error: cannot find symbol
[ERROR]
[ERROR] could not parse error message:   symbol:   variable player
[ERROR] location: class MagicMirrorHandler
[ERROR] /home/denis/kurento-tutorial-java/kurento-magic-mirror/src/main/java/org/kurento/tutorial/magicmirror/MagicMirrorHandler.java:103: error: cannot find symbol
[ERROR] String videoUrl = webRtcEndpoint.getUrl();
[ERROR] ^
[ERROR]
[ERROR] could not parse error message:   symbol:   method getUrl()
[ERROR] location: variable webRtcEndpoint of type WebRtcEndpoint
[ERROR] /home/denis/kurento-tutorial-java/kurento-magic-mirror/src/main/java/org/kurento/tutorial/magicmirror/MagicMirrorHandler.java:108: error: cannot find symbol
[ERROR] String sdpAnswer = playerEndpoint.processOffer(sdpOffer);
[ERROR] ^
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:


Of the log can be seen that the error in this line of code:
String sdpAnswer = playerEndpoint.processOffer(sdpOffer);

Maybe fix it?
String sdpAnswer = webRtcEndpoint.processOffer(sdpOffer);






четверг, 15 января 2015 г., 17:10:46 UTC+4 пользователь igracia написал:

Ivan Gracia

unread,
Jan 15, 2015, 11:07:36 AM1/15/15
to Kurento Public
Yes, you need to change that too. In any case, your IDE should have yelled at you, since the method processOffer is not available for playerEndpoint...

I suggest you take a couple of minutes studying the code, and really understanding what each component is for and how they are supposed to work together.

Ivan Gracia


Denis Syroezhkin

unread,
Jan 15, 2015, 12:03:29 PM1/15/15
to kur...@googlegroups.com
A couple of minutes? I did learn a month. I really need help, I have nowhere else to turn for help, did not see more forums devoted rival to

A better use RtpEndpoint?
What I want to do, perhaps?

четверг, 15 января 2015 г., 20:07:36 UTC+4 пользователь igracia написал:
Reply all
Reply to author
Forward
0 new messages