Browse Source

Ajout MediaPlayer mode Wake

pull/1/head
Samuel Vermeulen 6 months ago
parent
commit
ce1a6e55c8
  1. 1
      app/src/main/AndroidManifest.xml
  2. 4
      app/src/main/java/fr/svpro/radiomercure/MainActivity.java

1
app/src/main/AndroidManifest.xml

@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:allowBackup="true"

4
app/src/main/java/fr/svpro/radiomercure/MainActivity.java

@ -11,6 +11,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.PowerManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@ -53,7 +54,7 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//-------------A revoir-----------//
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
//--------------------------------//
web = findViewById(R.id.wv);
@ -177,6 +178,7 @@ public class MainActivity extends AppCompatActivity {
case R.id.live:
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setScreenOnWhilePlaying(true);
try {
mediaPlayer.setDataSource("https://live.radiomercure.fr/on-air/live");
} catch (IOException e) {

Loading…
Cancel
Save