Issue in starting stream in iOS browser

jasonkc

Member
I have tested the attached html pages on my ipad - testing.html and webrtc-as-rtmp-republishing.html; they are almost the same except that testing.html is called from a separate web server instead of calling it from the same server that has Flashphoner installed, and also the SRC in it points to absolute path of scripts needed.

However strangely I do not see prompt to ask for permission to use camera and audio device on my iPad (when opening testing.html page from separate webserver); it works when I open webrtc-as-rtmp-republishing.html from browser in both iPad and Windows desktop.

If I placed the same testing.html page in my server (Flashphoner installed), then call it from there, I could see the prompt for permission and also to start the stream....why is there a difference in outcome when calling it from different web server?
 

Attachments

jasonkc

Member
More testing reveal that I could start the stream with testing.html on same host (stream1-prod.jomliv.com) featuring Flashphoner on iPad, but only with Safari...it fails when trying on Chrome; the same html page works on Chrome and Firefox from my Windows PC though.
 

Max

Administrator
Staff member
Good day.
Please make sure that you're opening your HTML page via HTTPS, for example https://web-server/testing.html, because WebRTC does not work via HTTP.
Your sample page also works when opened as file from local disk in Chrome on Windows. We recommend you to comment sendDataToPlayer() function call, because there are no Flash player on the page any more:
Code:
function startStreaming(session) {
    var streamName = urlParams.get('user_id');
    var rtmpUrl = "rtmp://localhost:1935/live";
    session.createStream({
        name: streamName,
        display: localVideo,
        ...
    }).on(STREAM_STATUS.PUBLISHING, function(publishStream){
        setStatus(STREAM_STATUS.PUBLISHING);
        onStarted(publishStream);
//        sendDataToPlayer(); // This line should be commented out
        ...
    }).publish();
More testing reveal that I could start the stream with testing.html on same host (stream1-prod.jomliv.com) featuring Flashphoner on iPad, but only with Safari...it fails when trying on Chrome
This is a normal behaviour: on iOS devices, only Safari supports WebRTC publishing and playback, all the third party browsers (Chrom, Firefox, Opera etc) can only play HLS. This is Apple policy, no workaround.
 

jasonkc

Member
I hv commented out 'sendDataToPlayer' line, and tried with following URL:


But after clicking on START button, it still does not prompt for permission to use local media devices.
 

Max

Administrator
Staff member
But after clicking on START button, it still does not prompt for permission to use local media devices.
Unfortunately, your full link requires login credentials, so we cannot test it.
Please provide a browser console output in case the link does not work.
Please also clean browser settings for the site to make sure the permission should be granted again.
 

Max

Administrator
Staff member
We checked the example. You should set a full URL path to the preloader file for playFirstVideo() function to work in Safari:
Code:
# Replace this
#var PRELOADER_URL = "../../dependencies/media/preloader.mp4";
# to this
var PRELOADER_URL = "https://stream1-prod.jomlive.com:8888/client2/examples/demo/dependencies/media/preloader.mp4";
 

Max

Administrator
Staff member
Please use right comment characters
Code:
// var PRELOADER_URL = "../../dependencies/media/preloader.mp4";
var PRELOADER_URL = "https://stream1-prod.jomliv.com:8888/client2/examples/demo/dependencies/media/preloader.mp4";
 
Top