Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3058 Discussions

Media for Mobile RTMP authentication for Android camera stream to server

Amir_M_1
Beginner
864 Views

We are evaluating the INDE Media for Mobile encoder for a new Android app we are developing. The app streams live from the phone camera to a server. I would like to know if there is a way to use authentication between the camera streaming sample app which I believe uses RTMP streaming and a server (WOWZA in particular).

Streaming to WOWZA works fine with RTMP authentication disabled, but we cannot find a way to make it work with it enabled. We have tried setting the Username/Password/Secure properties in StreamingParameters with no luck. We have also tried file based authentication which allows passing the Username/Password parameters in the URL query (IP:port/application/?username&password/streamname). However, a complete URL query is not passed to the INDE encoder lib APIs, and rather the IP, port #, application and stream name are passed separately. Therefore, we could only try passing these parameters by attaching them to the end of the application name (application/?username&password) or the beginning of the streamname (?username&password/streamname). Neither of these worked either. 

Would be grateful for some guidance on how we can accomplish this.

0 Kudos
1 Solution
Benjamin_F_
Beginner
864 Views

Hi Amir,

I figured out how to use RTMP authentication on Android. The problem with the username and password in StreamingParameters is that the object is replaced whenever you edit the settings within the app (using the gear icon). If you were to write your own sample application from scratch, this would not be an issue. However if you are opening the app and changing the settings (like server IP/port/stream name) then your StreamingParameters object is being completely replaced (overwriting your username/password set on initialization of app).  Using their sample application you can do a quick and dirty fix to get RTMP authentication to work by hardcoding your credentials in onDismss() of StreamingSettingsPopup.java

An ideal solution would be to add a username/password input box to this class and set the parameters that way. I leave that to you.

 

    @Override
    public void onDismiss() {
        StreamingParameters parameters = new StreamingParameters();

        parameters.Host = ((EditText)getContentView().findViewById(R.id.host)).getText().toString();
        parameters.Port = Integer.parseInt(((EditText)getContentView().findViewById(R.id.port)).getText().toString());
        parameters.ApplicationName = ((EditText)getContentView().findViewById(R.id.applicationName)).getText().toString();
        parameters.StreamName = ((EditText)getContentView().findViewById(R.id.streamName)).getText().toString();

//Set your credentials here. Then run the app, go to the settings and set your server IP and stream name and then when you close the edit box this method will be called and your credentials will be set
        parameters.Username = "username";
        parameters.Password = "password";
        parameters.isToPublishAudio = false;
        parameters.isToPublishVideo = true;

        eventsListener.onStreamingParamsChanged(parameters);
    }

 

View solution in original post

0 Kudos
6 Replies
Harshdeep_B_Intel
864 Views

Hi Amir, 

Its an interesting case usage. I believe we have not considered your usage model support of (passing parameters with end/beginning of the application name (application/?username&password)) to M4M lib APIs with RTMP authentication enabled.  But, I have updated our development team on your feature request use case scenario (secure enabled) support with M4M lib APIs. Will update with further details, Stay tuned!

Thanks,

0 Kudos
Amir_M_1
Beginner
864 Views

Harsh,

Thanks for the quick response and for passing it onto your dev team. Just to be clear, we are open to any solution that allows us to authenticate the user session for a RTMP stream. Parameter passing in the URL query is one solution we have working with other encoder libs, but any other solution such as using the M4M lib APIs directly is also fine.As I noted, there already seems to be some provisioning for passing username and password in the M4M lib APIs (StreamingParameters object), but we have been unable to get this solution to work.

Thanks again.

Amir

0 Kudos
Harshdeep_B_Intel
864 Views

Hi Amir, 

Thank you for the note and clarification. Yes, currently passing parameters (username & password) separately is supported, but as I mentioned in previous post, the secure RTMP streaming use case was not considered and our team is investigating this scenario. Will update with more information. 

Thanks, 

0 Kudos
Amir_M_1
Beginner
865 Views

Hi Harsh,

Just checking in to see if there's been any progress on this or any feedback form your dev team.

Thanks,
Amir

0 Kudos
Benjamin_F_
Beginner
865 Views

Hi Amir,

I figured out how to use RTMP authentication on Android. The problem with the username and password in StreamingParameters is that the object is replaced whenever you edit the settings within the app (using the gear icon). If you were to write your own sample application from scratch, this would not be an issue. However if you are opening the app and changing the settings (like server IP/port/stream name) then your StreamingParameters object is being completely replaced (overwriting your username/password set on initialization of app).  Using their sample application you can do a quick and dirty fix to get RTMP authentication to work by hardcoding your credentials in onDismss() of StreamingSettingsPopup.java

An ideal solution would be to add a username/password input box to this class and set the parameters that way. I leave that to you.

 

    @Override
    public void onDismiss() {
        StreamingParameters parameters = new StreamingParameters();

        parameters.Host = ((EditText)getContentView().findViewById(R.id.host)).getText().toString();
        parameters.Port = Integer.parseInt(((EditText)getContentView().findViewById(R.id.port)).getText().toString());
        parameters.ApplicationName = ((EditText)getContentView().findViewById(R.id.applicationName)).getText().toString();
        parameters.StreamName = ((EditText)getContentView().findViewById(R.id.streamName)).getText().toString();

//Set your credentials here. Then run the app, go to the settings and set your server IP and stream name and then when you close the edit box this method will be called and your credentials will be set
        parameters.Username = "username";
        parameters.Password = "password";
        parameters.isToPublishAudio = false;
        parameters.isToPublishVideo = true;

        eventsListener.onStreamingParamsChanged(parameters);
    }

 

0 Kudos
Amir_M_1
Beginner
865 Views

Hi Benjamin,

You've indeed pinpointed the problem with the sample app re RTMP auth. Your suggestion resolves the issue and I am able to send a stream to WOWZA with RTMP authentication. Many thanks for your help.

Best,

Amir

0 Kudos
Reply