Ant media webrtc connecting to server gives java.security.cert.CertPathValidatorException - android

I'm trying to connect to Ant media webrtc server wss://abcd.com:1234/demoApp/websocket. However it always throws.
de.tavendo.autobahn.WebSocketReader: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
de.tavendo.autobahn.WebSocketWriter: Socket is closed
I'm using ant media webrtc framework sample android example and changing the URL. It worked fine with test server of antmedia
wss://test.antmedia.io:5443/demo1234/websocket(URL changed for security purposes)
However I was never able to connect to the main server. This is the code at android which I'm using to connect with server.
webRTCClient = WebRTCClient(this#LiveSessionActivity, this)
webRTCClient.setVideoRenderers(mLiveSessionBinding?.pipViewRenderer, mLiveSessionBinding?.localGLSurfaceView)
webRTCClient.init(ANT_MEDIA_URL, mLiveSessionViewModel?.streamKey, IWebRTCClient.MODE_PUBLISH, "null", intent)
Any help is much appreciated. Thanks!

It's known issue in v2.2.1. You need to set chain.pem file to Ant Media Server. Here are the instructions:
Copy chain.pem to conf.
sudo cp /etc/letsencrypt/live/your_domain/chain.pem /usr/local/antmedia/conf
PS: Please change your_domain to your domain address.
1- Add this line
http.ssl_certificate_chain_file=conf/chain.pem
after
http.ssl_certificate_file=conf/fullchain.pem
in /usr/local/antmedia/conf/red5.properties file.
2- Add this line
<entry key="SSLCertificateChainFile" value="${http.ssl_certificate_chain_file}" />
after
<entry key="SSLCertificateFile" value="${http.ssl_certificate_file}" />
in /usr/local/antmedia/conf/jee-container.xml file

Related

React native video unable to play m3u8 file

Problem
I'm trying to stream a m3u8 file in a react native app (for android TV) and I'm getting this error:
LOG {"error": {"errorCode": "22004", "errorException": "com.google.android.exoplayer2.ExoPlaybackException: Source error", "errorStackTrace": "com.google.android.exoplayer2.ExoPlaybackException: Source error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:632)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:604)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403
at com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource.open(OkHttpDataSource.java:329)
at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:258)
at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:99)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.open(DataSourceInputStream.java:62)
at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:174)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:412)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
", "errorString": "ExoPlaybackException: ERROR_CODE_IO_BAD_HTTP_STATUS"}}
I don't know java so from the above traceback I'm guessing that the server is responding with an HTTP 403 and therefore it is unable to stream the file.
What I've tried
This one is not much of a solution but I tried switching to the react-native-video-player instead of react-native-video but that didn't work.
I tried passing the type: 'm3u8' and type: 'hls' inside the source attribute of the video tag along with the uri and this didn't help at all.
Tried to check if another m3u8 url (i.e. from another domain/server) is working, and it is working.
Downgrading react-native-video version, problem persists with different error message.
I decided to ssh into my android TV and directly use curl to fetch the m3u8 file and it responds with this:
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Moreover, many of the issues I found on github having a similar problem contain a URL that gives the same response when fetched directly with curl. Interestingly, if I use the fetch API in JS to console log the response from the m3u8 url, it works perfectly. So I'm guessing the problem is somewhere in exoplayer.
Specs
react-native : 'npm:react-native-tvos#0.69.6-0'
react-native-video : '^6.0.0-alpha.3'
Android TV : Tested both on a Raspberry Pi running Android TV (LineageOS I think) and an actual android tv set top box with same results.
The issue was with the user-agent header, exoplayer was setting a user-agent which was causing an HTTP 403. I had to use a proxy to figure this out and still have no clue as per why android studio was not showing the request that had an error.

Not able to git push or pull in android studio 3.6

I'm getting the following error while trying to push or pull or anything with ssh in android studio 3.6
Update failed Invocation failed Unexpected Response from Server: Unauthorized java.lang.RuntimeException: Invocation failed Unexpected Response from Server: Unauthorized at org.jetbrains.git4idea.nativessh.GitNativeSshAskPassXmlRpcClient.handleInput(GitNativeSshAskPassXmlRpcClient.java:34) at org.jetbrains.git4idea.nativessh.GitNativeSshAskPassApp.main(GitNativeSshAskPassApp.java:30) Caused by: java.io.IOException: Unexpected Response from Server: Unauthorized at org.apache.xmlrpc.LiteXmlRpcTransport.sendRequest(LiteXmlRpcTransport.java:231) at org.apache.xmlrpc.LiteXmlRpcTransport.sendXmlRpc(LiteXmlRpcTransport.java:90) at org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:72) at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194) at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185) at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178) at org.jetbrains.git4idea.nativessh.GitNativeSshAskPassXmlRpcClient.handleInput(GitNat..................
looks like the problem is with native ssh and we cannot change it to built-in like previous versions... how to fix this ???
any help would be appreciated
WORKAROUND:
1. In Android Studio go to Help - Find Action - Registry...
2. Find git.use.builtin.ssh and enable it
3. Check that git works again
Not straight solution - but you can change your git url from ssh to https, and it will work.
git remote set-url origin YOUR_REPOSITORY_HTTPS_URL
I have found an alternative way to make SSH actually work...
rate up if it worked for you!!!
using putty plink for ssh instead of the Git ssh(openSSH)
1.set the system env-variable GIT_SSH and let it point to plink.exe
download links available here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
2.start pageant and add your private key to it (needs to be converted to another format to be used)(use puttygen to convert id_rsa to ppk)
3.use command in terminal based on github or gitlab : plink -v git#github.com or plink -v git#gitlab.com
congrats now you can work with ssh

Unable to connect to firebaseio.com

OK, this may not be the right place to post this, but I am exhausted on ideas.
I have an Ionic2 app with AngularFire2. I can not connect to firebaseio.com from the mobile device.
It is likely a whitelist issue, but damned if I can find it. I have
<allow-intent href="https://*.firebaseio.com/*" />
everything woks fine in an emulator, localhost, just not on the physical device. I connected to the app running remote device with chrome-tools and did see that I am not connecting to the firebaseio.com server. I see
Failed to load resource appname.firebaseio.com/.lp?start=t&ser=94215074&cb=12&v=5
Failed to load resource appname.firebaseio.com/.lp?start=t&ser=94215074&cb=12&v=5
The status is (failed), not 404, not 500, just (failed).
I have updated everything. Firebase 2.7.8, Ionic-cli 2.2.3, angular 4.0.0, angularfire2 4.0.0-rc0 still same errors.
I have added the following the following cordova plugins, but nothing seems to help.
cordova-plugin-buildinfo
cordova-universal-links-plugin
cordova-plugin-browsertab
cordova-plugin-inappbrowser
Any insight would be greatly appreciated.
Do you need to change https://.firebaseio.com/ to https://*.firebaseio.com/* ? (missing *s)
Per the cordova docs:
Wildcards are allowed for the protocol, as a prefix
to the host, or as a suffix to the path
Example:
<allow-intent href="*://*.example.com/*" />
You currently have .firebaseio.com (emphasis on the . before firebaseio). Usually you'll need to do something like https://*.firebaseio.com
The platforms were corrupt. I removed and added the android platform and that resolved the issue.

Git repo sync - connection lost

I'm trying to download android source (Cyanogenmod). i have spent more than 12hrs to download 2.5GB files, Now my connection lost for a while, it shows
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/misc/': Could not resolve host: android.googlesource.com
fatal: unable to access 'https://github.com/CyanogenMod/android_packages_inputmethods_LatinIME/': Could not resolve host: github.com
fatal: unable to access 'https://android.googlesource.com/platform/prebuilts/misc/': Could not resolve host: android.googlesource.com
error: Cannot fetch CyanogenMod/android_packages_inputmethods_LatinIME
error: Cannot fetch platform/prebuilts/misc
error: Exited sync due to fetch errors
Can i resume the download or i should download from the beginning, please help me to resume my download.
Thank you!
Once you have applied the fix that I describe below, you should simply re-run repo sync in order to resume and fully complete the resource synchronization process that was interrupted by these fatal errors.
The solution to the DNS-related error that you've encountered [fatal: Could not resolve host] is detailed on the Known Issues resolution page at Google's AOSP Developer Site. Apply this fix by adding the appropriate host entry for your remote repository android.googlesource.com inside your development machine's /etc/hosts config file. Begin by clicking here and here to execute the IP address lookup tool provided by the free web resource: http://network-tools.com/nslook/.
Google's full description of this issue with detailed resolution I've included here:
Difficulties syncing the source tree (DNS issues).
Symptom: When running repo sync, the process fails with various errors
related to not recognizing the hostname. One such error is
<urlopen error [Errno -2] Name or service not known>.
EDIT: Another fatal error might be Could not resolve host.
Cause: Some DNS systems have a hard time coping with the high number
of queries involved in syncing the source tree (there can be several
hundred requests in a worst-case scenario).
Fix: Manually resolve the relevant hostnames, and hard-code those
results locally.
You can resolve them with the nslookup command, which will give you
one numerical IP address for each of those (typically in the "Address"
part of the output).
$ nslookup googlesource.com
$ nslookup android.googlesource.com
You can then hard-code them locally by editing /etc/hosts, and adding two
lines in that file, of the form:
aaa.bbb.ccc.ddd googlesource.com
eee.fff.ggg.hhh android.googlesource.com
Note that this will only work as long as the
servers' addresses don't change, and if they do and you can't connect
you'll have to resolve those hostnames again and edit etc/hosts
accordingly.
You don't resume a clone, you can try a shallow clone instead.
As mentioned here:
Error code 56 indicates a curl receive error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the clone process.
Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.
You can know more with:
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1
You can try changing http.postBuffer or switching to ssh url clone.
Spartan i checked the Cyanogenmod its working normally i prefer use internet download manager.i download 60mp and recall it.successfully fetched and resumed.
Could not resolve host: android.googlesource.com
Which could be a DNS server problem. Try first restarting your modem in order to flush its DNS cache. If you're still seeing the problem, try changing your Primary DNS to either one these two publicized DNS servers that Google operates:
8.8.8.8
8.8.4.4
Note that, if your Primary DNS has already been configured as described and you've also long-rebooted the router without resolution (pun intended), then adjusting your Primary DNS configuration to point at other public DNS servers is not likely to fix your situation. However, a reputable list of no-cost public servers can be found here.

avformat_open_input returns -2 (Android)

I'm using this FFMPEG port for Android.
My Goal is to read RTSP stream eventually.
I can open a stream from a local file (located at "/storage/emulated/0/bunny.mp4") ,
using *avformat_open_input* function.
However when I try to open the same file from remote location like *"http_://192.168.1.183/bunny.mp4*" , it returns error -2 .
The whole cpp code is here.
Any ideas ?
Check if you have INTERNET permission in your manifest.
Also check that you are building ffmpeg with tcp and rtsp protocol enabled. And codecs enabled, too. I believe FFMPEG's configure prints this info when building and also it's in the build log.
Also, there's a FFMPEG function to print error message by code, don't remember the name though. So you can call it and see what -2 error means.
This here project has FFMPEG configured correctly https://github.com/dannoy/dolphin-player look in the p folder

Categories

Resources