rtspviewersf icon indicating copy to clipboard operation
rtspviewersf copied to clipboard

Allow rtsps URLs

Open nh2 opened this issue 9 years ago • 2 comments

Hi, thanks for this nice app.

Gstreamer also allows rtsps URLs (RTSP over a secure TLS connection), but your client forbids those here.

Could you make another version that does not have these restriction, potentially allowing any URL that gstreamer accepts?

That would be very helpful!

nh2 avatar Mar 01 '15 23:03 nh2

I just want to say that this (rtsps:// URL) actually works.

I'm setting up a server like described here using gst-rtsp-server/examples/test-video. This uses a demo/invalid SSL certificate, so I had to add to the code to ignore all certificate errors to try it out:

diff --git a/jni/rtspviewer.c b/jni/rtspviewer.c
index 3dc3134..f00fbcf 100644
--- a/jni/rtspviewer.c
+++ b/jni/rtspviewer.c
@@ -23,6 +23,7 @@
  */
 #include <gst/video/video.h>
 #include <gst/video/videooverlay.h>
+#include <gio/gio.h>
 #include <android/native_window.h>
 #include <android/native_window_jni.h>

@@ -212,6 +213,7 @@ need_data_cb (GstElement *playbin, GstElement *rtspsrc, gpointer user_data)

   g_object_set (G_OBJECT (rtspsrc), "user-id", priv->user, NULL);
   g_object_set (G_OBJECT (rtspsrc), "user-pw", priv->pass, NULL);
+  g_object_set (G_OBJECT (rtspsrc), "tls-validation-flags", G_TLS_CERTIFICATE_GENERIC_ERROR, NULL);
 }

 static GstElement *

It worked!

Code suggestion: Simply remove all constraints on the URI:

diff --git a/src/com/gst_sdk_tutorials/rtspviewersf/ConfigurationManager.java b/src/com/gst_sdk_tutorials/rtspviewersf/ConfigurationManager.java
index 3834ad7..9396c35 100644
--- a/src/com/gst_sdk_tutorials/rtspviewersf/ConfigurationManager.java
+++ b/src/com/gst_sdk_tutorials/rtspviewersf/ConfigurationManager.java
@@ -269,8 +269,7 @@ public class ConfigurationManager extends ListActivity {
                 String user = userv.getText().toString();
                 String pass = passv.getText().toString();

-                if (!uri.isEmpty() && (uri.startsWith("rtsp://") ||
-                        uri.startsWith("rtspt://") || uri.startsWith("rtsph://"))) {
+                if (!uri.isEmpty()) {^M
                     if (selected_position == -1) {
                         HashMap<String, String> item = new HashMap<String, String>();
                         item.put("uri", uri);

If you remove this startsWith restriction, your viewer can indeed play secure RTSP sources - which seems to be a unique feature across all available apps on the Market, VLC and RTSP Player both cannot do this!

nh2 avatar Mar 02 '15 01:03 nh2

Hi! thank you very much for the hint, i am going to fix it now! and sorry for the late reply, it's just now that i am seeing your email! Best regards! /o

On Mon, Mar 2, 2015 at 12:48 AM, Niklas Hambüchen [email protected] wrote:

Hi, thanks for this nice app.

Gstreamer also allows rtsps URLs (RTSP over a secure TLS connection), but your client forbids those here https://github.com/otonchev/rtspviewersf/blob/e57923e29b02216004024ac584cf3cf5beb871da/src/com/gst_sdk_tutorials/rtspviewersf/ConfigurationManager.java#L273 .

Could you make another version that does not have these restriction, potentially allowing any URL that gstreamer accepts?

That would be very helpful!

— Reply to this email directly or view it on GitHub https://github.com/otonchev/rtspviewersf/issues/1.

otonchev avatar Mar 07 '15 23:03 otonchev