React native video unable to play m3u8 file - android

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.

Related

Do not play m3u8 with chrome cast android

I getting errors when try to play m3u8 : W/MediaControlChannel: received unexpected error: Invalid Request.
W/MediaQueue: Error fetching queue item ids, statusCode=2100,
statusMessage=null.
I don’t understand if the problem is with the server CORS or the if the error is in the android app.
Link - "https://cdn.dev.yomobile.xyz/test/hls/c35ce4c4-d8a9-49ea-98a3-b98f99d4b8d4/master.m3u8"
You can see projects with my code integration cast https://github.com/OlegKopeykin/chromecast-simple

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

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

Podio Android SDK item create API call error "Object not found"

I have a problem with the Podio SDK on Android in the following scenario:
I have uploaded an image to Podio from our server in a php script and returned the file_id to my Android app via http. The id seems to be valid, but when i try to create an item using this file_id for an image field value i get the following error messages:
E/Volley: [49051] BasicNetwork.performRequest: Unexpected response code 404 for https://api.podio.com/item/app/17418679
com.podio.sdk.ApiError: {"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/item\/app\/17418679","query_string":"","method":"POST"},"error_description":"Object not found","error":"not_found"}
If i do not attach the image the item create call works fine
I used the newest version of the Podio Android SDK from Github (https://github.com/podio/podio-android) compiled using Android Studio 2.3 and build tools version 25.
I already found an error where the wrong app_id was used, but fixing that still left me with the same message.
This used to work only a few weeks ago, maybe there was change in the API? Do you have any tips on what else could cause this problem? I am using different client id / secret in the php script than in the app, could that be the reason?

Unable to request ads from server due to network error- IMA SDK Error and iOS

I am using IMA SDK (iOS - Swift) to play pre-roll ads(Wrapper VAST 3.0)
But when i use this url "http://fusioniprojects.com/rnd/addpod/adpods.xml"
I am getting following error in my log
"Unable to request ads from server due to network error."
and when i am using the url of this type -
"https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirecterror&correlator="
its running fine.
I fallow the solution of this problems from here ( ref - https://groups.google.com/forum/#!topic/ima-sdk/DqE5GruzwwA),
Now its Playing only 1 ad in Android project,not multiple ad and not working for iOS at all.
It may be that I am doing some things wrong in my iOS project but i also downloads the sample project from IMA-SDK (ref - https://github.com/googleads/googleads-ima-ios/releases), But it did not help me to come out with this problems, I am getting same error.I don't know how is it running (at least 1 ad) for the Android project after changes on the server.
Is it problems of IMA-SDK? or am I doing something wrong?
Used IMA SDK version 3.3.1 in iOS.
If you are using Apache sever then To add the CORS authorization to the header using Apache, simply add the following line inside either the Directory, Location, File or VirtualHost sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file: below of the code put inside .htacces file.
Header set Access-Control-Allow-Origin '*'
Header set Access-Control-Allow-Credentials true

ibm-mobilefirst-starter container for Bluemix - adding new http adapter not working

I created ibm-mobilefirst-starter:latest container in bluemix. And I am able to access the MFS console.I can see MobileFirstStarter run time its working fine. Now I uploaded new .wlapp and one http .adapter file into MFS console and they are visible in Console. When I try to access the Adapter from Common Resources I am getting Error :
[http://134.168.31.10:9080/MobileFirstStarter/authorization/v1/clients/preview] failure. state: 404, response: The server was unable to process the request from the application. Please try again later.
Client registration failed with error: {"responseHeaders":{"Date":"Tue, 01 Mar 2016 12:35:44 GMT","Connection":"Close","X-Powered-By":"Servlet/3.0","Content-Length":"0","Content-Language":"en-US"},"status":404,"responseText":"","errorCode":"UNEXPECTED_ERROR","errorMsg":"The server was unable to process the request from the application. Please try again later.","invocationContext":null}
I tried with Android environment and tested in device. Couldn't see any response from adapter.
Thanks in Advance.
There is no preview available from the console in non-development environments (i.e. MobileFirst Studio plug-in for Eclipse).
It is unclear from your question if only the preview failing or also from a device/emulator.

Categories

Resources