finish activity when network error occurs during livestream

This commit is contained in:
Schoumi 2021-07-26 20:38:57 +02:00
parent 0f5c390855
commit 1573afb279
4 changed files with 16 additions and 8 deletions

View File

@ -50,6 +50,9 @@ class MainActivity : AppCompatActivity() {
StreamActivity.STOP -> {
alertBuilder.setMessage(R.string.stop_reason)
}
StreamActivity.NETWORK_ERROR -> {
alertBuilder.setMessage(R.string.network_reason)
}
}
alertBuilder.setPositiveButton(android.R.string.ok,null)
alertBuilder.show()

View File

@ -43,10 +43,11 @@ class StreamActivity : AppCompatActivity() {
private var rotationIsLanternEnabled: Boolean = true
companion object {
const val BACKGROUND :Int = 1
const val LOCK :Int = 2
const val BACK :Int = 3
const val STOP :Int = 4
const val BACKGROUND :Int = 1
const val LOCK :Int = 2
const val BACK :Int = 3
const val STOP :Int = 4
const val NETWORK_ERROR :Int = 5
}
@ -258,6 +259,8 @@ class StreamActivity : AppCompatActivity() {
runOnUiThread {
Toast.makeText(binding.root.context, "Connection failed", Toast.LENGTH_SHORT).show();
rtmpCamera1.stopStream()
setResult(NETWORK_ERROR)
finish()
}
}

View File

@ -25,6 +25,7 @@
<string name="lock_reason">Votre direct s\'est terminé car le téléphone a été verrouillé</string>
<string name="stop_reason">Votre direct est terminé</string>
<string name="ask_end_stream">Voulez-vous arrêter le direct\?</string>
<string name="network_reason">Votre direct s\'est terminé à cause d\'un problème réseau</string>
<!-- buttons -->
<string name="choose_channel">Chaîne</string>
<string name="go_live">Démarrer le direct!</string>

View File

@ -20,11 +20,12 @@
<string name="delete_account">Delete the %s account associated with the %s server\?</string>
<string name="tags_rules">Maximum 5 tags, each between 2 and 30 characters, separate by comma</string>
<string name="save_replay_info">If you enable this option, your live will be terminated if you exceed your video quota</string>
<string name="back_reason">Your live has ended after you pressed back button</string>
<string name="background_reason">Your live has ended because the app has gone to background</string>
<string name="lock_reason">Your live has ended because the phone was locked</string>
<string name="stop_reason">Your live has ended</string>
<string name="back_reason">Your livestream ended after you pressed back button</string>
<string name="background_reason">Your livestream ended because the app has gone to background</string>
<string name="lock_reason">Your livestream ended because the phone was locked</string>
<string name="stop_reason">Your livestream ended</string>
<string name="ask_end_stream">Do you want to stop the live?</string>
<string name="network_reason">Your livestream ended because of a network problem</string>
<!-- buttons -->
<string name="choose_channel">Channel</string>
<string name="go_live">Start livestream</string>