ossrs / flutter_live

Live streaming player, iOS+Android, RTMP/HTTP-FLV/HLS/WebRTC, by Flutter+SRS.
https://ossrs.net
MIT License
333 stars 104 forks source link

webrtc stream can NOT be played in flutter_live if pushing mp4 video file like this #15

Open ryantan1 opened 2 years ago

ryantan1 commented 2 years ago

clone git and build it successfully. run it on android 9 os. push mp4 video file with following command: ./ffmpeg -re -i video.mp4 -c copy -f flv -y rtmp://ip:1935/live/mp4test

then webrtc://ip/live/mp4test can be played via SRS rtcplayer in browser while can NOT be played by flutter_live apk.

how to fix it? could you please give some hint? thanks a lot!

ryantan1 commented 2 years ago

stream server is SRS4.0 which support RTC

efinal commented 2 years ago

try these two steps:

  1. the h5 rtcplayer will by default use the same protocol with demo html page, which usually the http. while flutter_live apk will by default use https. if your srs server doesn't provide valid https connection, the apk will failed to play
  2. if https can't be provided, you can append ?schema=http to the webrtc url, like webrtc://ip/live/mp4test?schema=http in this case, you also need add android:usesCleartextTraffic="true" to your example/android/app/src/main/AndroidManifest.xml in the application node to allow android connect to unsecure http site.

hope it helps