Android Media Player RTSP

不羁岁月 提交于 2019-12-03 08:38:24

I'm developing the RTSP related code just like you, and I found the following conclusions:

  1. When using MediaPlayer, your RTSP_URL can be like: rtsp://account:pass@192.168.0.x
  2. But with the authentication you mentioned, if your camera use HTTP basic auth, you need to add header in http request:, ex(I use OKHTTP 2.0):

    String basicAuth = Credentials.basic("account", "pass"); Request request = new Request.Builder().url(url).header("Authorization", basicAuth).build(); Response response = client.newCall(request).execute();

That works for me! Hope it's helpful for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!