* minSdk: API level 21 (Android 5) required by
org.webrtc:google-webrtc:1.0.32006 (Google WebRTC).
* targetSdk: API level 31 (Android 12) required by Google Play Store,
since August 1, 2022.
See: https://support.google.com/googleplay/android-developer/answer/11926878
* compileSdkVersion: Should match "targetSdk".
The upgrade also required adding `android:exported` to the manifest.
Retain support for OpenVidu v2.22 and older; these legacy properties
will stop being needed starting from OpenVidu v2.23, where
`customIceServers` will always contain all necessary TURN info.
A bad SDP will be rejected by the WebRTC implementation, so no further
publish/subscribe operations should be done on failure.
This expands on the idea of
https://github.com/OpenVidu/openvidu-tutorials/pull/174
and also simplifies implementations of CustomSdpObserver: there is no
need to inherit its methods just for logging, as CustomSdpObserver
already logs everything on its default implementation.
Having a custom "log()" method didn't bring many advantages, and
actually lacked needed flexibility. We'd like to log success messages
to "debug", but failure messages to the "error" level.
When preparing to publish a video stream from an Android client app to OpenVidu session, it is possible that creating video offer succeeds but then setting it as the local description fails.
An example: Android client is configured to use a hardware video encoder, but a particular device does not have one. As a result, SDP description is created without some necessary video elements, and setting it as the local description fails at runtime.
The original code did not check the result of setting a local description before it went on to attempt publishing video. This resulted to breaking the whole OpenVidu session with rather severe consequences:
- various errors in server and client logs
- every participant's video streams stuck
- the session cannot be properly closed (it becomes a ghost session)
This simple fix checks if setting the local description succeeds, and only then attempts to publish video stream.
While this demo application does not configure HW encoder in use, other developers will use it as a basis for their apps. In addition, there can be other reasons why setting local description may fail. Hence, it should be checked.