# Processing is related to Android mode 'RTSP (RTP, SDP)'. Help me

**URL:** https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215
**Category:** Processing for Android
**Created:** [May 14, 2019, 4:07am UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215 "2019-05-14T04:07:51Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 14, 2019, 4:07am UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/1 "2019-05-14T04:07:51Z")

</div>

Processing is related to Android mode ‘RTSP (RTP, SDP)’.

The ‘processing.video’ library of the JAVA program makes it easy to resolve ‘RTSP’.

By the way, as far as I know  
The ‘processing.video’ library does not support Android mode.  
Question 1) Does the ‘processing.video’ library work in Android mode?

```auto
import processing.video.*;
 
Movie movie;
 
void setup() {
  size(640, 360);
  Movie.supportedProtocols[0] = "rtsp";
 
  background(0);
  try
    {
    movie = new Movie(this, "rtsp://127.0.0.1:8554/");
    }
  catch (Exception e)
    {
    }
  }
 
void movieEvent(Movie m) {
  m.read();
}
 
void draw() 
  {
  image(movie, 0, 0, width, height);
  }

```

Question 2) Is there a good way to do ‘RTSP’ in Android mode?

I need your help.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [May 14, 2019, 8:18am UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/2 "2019-05-14T08:18:40Z")

</div>

@GWAK ===

- question 1= no
- question 2= yes, you can using android videoView or android native mediaPlayer - Be sure that the file referred by your rtsp is ok with android supported media codecs.  
more details here: [https://developer.android.com/guide/topics/media/media-formats](https://developer.android.com/guide/topics/media/media-formats)

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 15, 2019, 12:45am UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/3 "2019-05-15T00:45:03Z")

</div>

@akenaton

Thank you for your kind answer.

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 16, 2019, 1:03pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/4 "2019-05-16T13:03:08Z")

</div>

> **[pedroSG94/rtmp-rtsp-stream-client-java](https://github.com/pedroSG94/rtmp-rtsp-stream-client-java)**
>
> Library to stream in rtmp and rtsp for Android. All code in Java - pedroSG94/rtmp-rtsp-stream-client-java

Can I run that library for processing?  
In the above manner,  
I want to perform rtsp function.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [April 30, 2020, 6:22pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/5 "2020-04-30T18:22:19Z")

</div>

@GWAK ===  
difficult to help you without knowing exactly what you are doing:

- what kind of codec is used by your cam
- how the streaming is made (vlc?)
- what is the stream output codec and url

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [April 30, 2020, 9:28pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/6 "2020-04-30T21:28:12Z")

</div>

@akenaton

 ![A1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a2ac7bd647682bf8a402caca7cdd75ce21dca003.jpeg)

Please check the image.

I would like to check the video and sound of CCTV video on mobile.  
You cannot hear the sound with ‘MJPEG’.  
So, I think it is necessary to implement ‘RTSP’ on mobile.

**[JAVA MODE]**

> import VLCJVideo.\*;
> 
> VLCJVideo video;
> 
> void setup() {  
> size(640, 360);  
> video = new VLCJVideo(this);  
> video.openAndPlay(“rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/”);  
> }
> 
> void draw() {  
> background(0);  
> image(video, 0, 0);  
> }

[INFORMATION]

> ID : admin  
> PW : aa852456!  
> ip address : [myksj1105.iptime.org:8081](http://myksj1105.iptime.org:8081)  
> (port : 8081)

Please review. I want to solve it in ‘Android Mode’.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [May 1, 2020, 1:18pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/7 "2020-05-01T13:18:14Z")

</div>

@GWAK ===  
ok, i understand what you are wanting;  
one more question: are you sure that you have to use RTP ? Why? - Using http should be more simple with a webView.  
Anyway it is not easy to code that using a videoView without any library; there are a lot of problems with codecs and as for now i think that the most sure way is to add the genuine VLC library to your app. It exists for android but is it possible to add it to Processing, i dont know. I have to see.

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 1, 2020, 11:11pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/8 "2020-05-01T23:11:11Z")

</div>

@akenaton,

I can`t be implemented as a webView.  
(You can also implement it as ‘webView’?)

I tried, but it doesn’t.  
Is there a workaround(solution)?

> act = this.getActivity();  
> wbc = new WebViewClient();
> 
> webview = new WebView(act);  
> webview.setLayoutParams(new RelativeLayout.LayoutParams( 1000, 1500 ));  
> webview.setX(0);  
> webview.setY(0);  
> webview.setWebViewClient(wbc);  
> webview.getSettings().setJavaScriptEnabled(true);  
> webview.loadUrl(“rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/”);
> 
> fl = (FrameLayout)act.findViewById(0x1000);  
> fl.setVisibility(View.VISIBLE);  
> fl.addView(webview);

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [May 2, 2020, 10:30am UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/9 "2020-05-02T10:30:47Z")

</div>

@GWAK === what error message, if any, with the webView?

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 2, 2020, 2:57pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/10 "2020-05-02T14:57:31Z")

</div>

@akenaton

link : [Can't play this video error in android WebView using RTSP stream - Stack Overflow](https://stackoverflow.com/questions/15066571/cant-play-this-video-error-in-android-webview-using-rtsp-stream)

> act = this.getActivity();  
> wbc = new WebViewClient();
> 
> webview = new WebView(act);  
> webview.setLayoutParams(new RelativeLayout.LayoutParams( 1000, 1500 ));  
> webview.setX(0);  
> webview.setY(0);  
> webview.setWebViewClient(wbc);  
> webview.getSettings().setJavaScriptEnabled(true);  
> webview.loadUrl(“rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/”);
> 
> fl = (FrameLayout)act.findViewById(0x1000);  
> fl.setVisibility(View.VISIBLE);  
> fl.addView(webview);

There is no error in the code above.

However, in order to execute ‘rtsp’, ‘ACTION\_VIEW’ must be set.  
Please refer to the link above.

Can you make the above source code for ‘Processing’?

Please review. Help. And thank you for the answer.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [May 2, 2020, 3:00pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/11 "2020-05-02T15:00:28Z")

</div>

@GWAK === yes, i know that there is no error in this code and that ACTION\_VIEW must be set; but when you set it to your URL what happens? What is the error code or what is the message inside the app?

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 2, 2020, 10:24pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/12 "2020-05-02T22:24:39Z")

</div>

@akenaton

> import android.app.Activity;  
> import android.content.Context;  
> import android.widget.FrameLayout;  
> import android.view.ViewParent;  
> import android.widget.RelativeLayout;  
> import android.text.Editable;  
> import android.graphics.Color;  
> import android.widget.Toast;  
> import android.os.Looper;  
> import android.view.WindowManager;  
> import android.view.inputmethod.InputMethodManager;  
> import android.os.Bundle;  
> import android.os.Environment;  
> import android.view.View;  
> import android.view.ViewGroup;  
> import android.webkit.WebView;  
> import android.webkit.WebViewClient;  
> import java.net.URI;  
> import java.net.URISyntaxException;  
> import android.content.Intent;
> 
> Activity act;  
> FrameLayout fl;
> 
> WebView webview;  
> WebViewClient wbc;
> 
> //@Override  
> public void onStart() {  
> super.onStart();
> 
> act = this.getActivity();
> 
> wbc = new WebViewClient();
> 
> webview = new WebView(act);  
> webview.setLayoutParams(new RelativeLayout.LayoutParams( 1200, 800 ));  
> webview.setX(100);  
> webview.setY(50);  
> webview.setWebViewClient(wbc);  
> webview.getSettings().setJavaScriptEnabled(true);
> 
> webview.loadUrl(“rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/”);
> 
> webview.setWebViewClient(new WebViewClient() {
> 
> ```
> public boolean shouldOverrideUrlLoading(WebView view, String url) {
> if (url.startsWith("rtsp")) {
> URI uri = URI.parse(url);
> Intent intent = new Intent(Intent.ACTION_VIEW, uri);
> act.startActivity(intent);
> return true;
> }
> return super.shouldOverrideUrlLoading(view, url);
> }
> 
> ```
> 
> });
> 
> fl = (FrameLayout)act.findViewById(0x1000);  
> fl.addView(webview);  
> }
> 
> void settings() {  
> fullScreen();  
> }
> 
> void setup() {  
> orientation(PORTRAIT);  
> background(255, 250, 0);  
> }
> 
> void draw() {  
> }

> * * *
> 
> 1. ERROR in C:\Users\user\AppData\Local\Temp\android6658805089143585074sketch\src\processing\test\webview\_test\webVIEW\_TEST.java (at line 90)  
> URI uri = URI.parse(url);  
> ^^^^^  
> The method parse(String) is undefined for the type URI
> 
> * * *
> 
> 1. ERROR in C:\Users\user\AppData\Local\Temp\android6658805089143585074sketch\src\processing\test\webview\_test\webVIEW\_TEST.java (at line 91)  
> Intent intent = new Intent(Intent.ACTION\_VIEW, uri);  
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> The constructor Intent(String, URI) is undefined
> 
> * * *
> 
> 5 problems (2 errors, 3 warnings)

I don’t know how to add the source code.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [May 3, 2020, 2:12pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/13 "2020-05-03T14:12:15Z")

</div>

@GWAK ===  
the code you have put cannot run; there are at least 3 errors:

- fl (the frame layout) cannot be acceeded as you do (it was possible before, but now it does not work) ; you have to code:  
`fl = (FrameLayout) act.getWindow().getDecorView().getRootView();`
- 

```auto

```

your shouldOverrideUrlLoading(WebView view, String url){ method is absolutely useless in your case and it is deprecated; this method is useful when the user wants to change the url and that is not your case; more details here: [https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String))  
so you comment all these lines since webView.set…But if you want to use ACTION\_VIEW instead of loadUrl then comment loadURL() and write:

```auto
String url = "rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/";
   Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    act.startActivity(intent);

```

- Last problem is that for parsing your import is not the good one; you have to import  
`import android.net.Uri;`

Now i think that the code will run… Of course i cannot test as i dont know if your cam is running… but with another url it works.  
dont forget to ask for internet permission!

```auto

```

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 3, 2020, 3:15pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/14 "2020-05-03T15:15:44Z")

</div>

@akenaton

I solved it thanks to you.

It wasn’t solved within the application screen, but it was connected to ‘video’ and played.

thank you. Thank you very much.

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [May 3, 2020, 3:16pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/15 "2020-05-03T15:16:44Z")

</div>

@GWAK === ok, put answered for others

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [May 3, 2020, 3:17pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/16 "2020-05-03T15:17:48Z")

</div>

Yes please. Show that part of the code!

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 3, 2020, 3:19pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/17 "2020-05-03T15:19:05Z")

</div>

> import android.app.Activity;  
> import android.content.Context;  
> import android.widget.FrameLayout;  
> import android.view.ViewParent;  
> import android.widget.RelativeLayout;  
> import android.text.Editable;  
> import android.graphics.Color;  
> import android.widget.Toast;  
> import android.os.Looper;  
> import android.view.WindowManager;  
> import android.view.inputmethod.InputMethodManager;  
> import android.os.Bundle;  
> import android.os.Environment;  
> import android.view.View;  
> import android.view.ViewGroup;  
> import android.webkit.WebView;  
> import android.webkit.WebViewClient;  
> //import java.net.URI;  
> //import java.net.URISyntaxException;  
> import android.content.Intent;  
> import android.webkit.WebResourceError;  
> import android.webkit.WebResourceRequest;  
> import android.webkit.WebView;  
> import android.webkit.WebViewClient;
> 
> import android.net.Uri;
> 
> Activity act;  
> FrameLayout fl;
> 
> WebView webview;  
> WebViewClient wbc;
> 
> //@Override  
> public void onStart() {  
> super.onStart();
> 
> act = this.getActivity();
> 
> wbc = new WebViewClient();
> 
> webview = new WebView(act);
> 
> webview.setLayoutParams(new RelativeLayout.LayoutParams( 1000, 1500 ));  
> webview.setX(100);  
> webview.setY(50);  
> // webview.setWebViewClient(wbc);  
> webview.getSettings().setJavaScriptEnabled(true);  
> // webview.loadUrl(“rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/”);  
> String url = “rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/”;  
> Intent intent = new Intent(Intent.ACTION\_VIEW, Uri.parse(url));  
> act.startActivity(intent);
> 
> // fl = (FrameLayout)act.findViewById(0x1000);  
> fl = (FrameLayout) act.getWindow().getDecorView().getRootView();  
> fl.addView(webview);
> 
> }
> 
> void settings() {  
> fullScreen();  
> }
> 
> void setup() {  
> orientation(PORTRAIT);  
> background(255, 250, 0);  
> }
> 
> void draw() {  
> }

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 3, 2020, 3:32pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/18 "2020-05-03T15:32:52Z")

</div>

@akenaton  
@noel

 ![tt](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/958d5b76a063cadd4e14724053f0d51e62e466ec.jpeg)

What we want to implement through this ‘solution’ is as follows.  
Development of real-time verification system through CCTV

thank you.

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [May 3, 2020, 3:53pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/19 "2020-05-03T15:53:46Z")

</div>

> [@GWAK](#):
>
> rtsp://admin:aa852456!@myksj1105.iptime.org:8081/11/

I still don’t understand where the server resides. Because it is is on a local LAN isn’t it.  
Is it the camara, that creates a virtual server?

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [May 3, 2020, 3:59pm UTC](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215/20 "2020-05-03T15:59:04Z")

</div>

@noel

Normally, a floating ip is given.

However, cctv requires a static ip address.  
So the workaround can be implemented via ‘DDNS’.

exam1)  
site1 ip address: 116.148.4.8  
url: [myksj1105.iptime.org](http://myksj1105.iptime.org)

exam2)  
site1 ip address: 116.148.4.20  
url: [myksj1105.iptime.org](http://myksj1105.iptime.org)

You can also check it from outside through ‘DDNS’.

CCTV inside,  
‘HTTP’  
‘RTSP’  
‘HTTPS’  
Etc. The server is built-in.

We just need to match the ip address.

[Next page](https://discourse.processing.org/t/processing-is-related-to-android-mode-rtsp-rtp-sdp-help-me/11215.md?page=2)
