implemented stage 1 ultra-basic background play of videos; see https://github.com/theScrabi/NewPipe/wiki/Background-Playback-Mini-Roadmap

This commit is contained in:
Adam Howard 2015-11-24 00:40:36 +00:00
parent 67324bfc80
commit 943027ffdd
3 changed files with 91 additions and 2 deletions

View file

@ -287,13 +287,26 @@ public class ActionBarHandler {
}
public void playAudio() {
Intent intent = new Intent();
boolean b = true;//todo: replace with preference
Intent intent;
if (b)//internal (background) music player: explicit intent
{
intent = new Intent(activity, BackgroundPlayer.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(audioStream.url),
MediaFormat.getMimeById(audioStream.format));
intent.putExtra(Intent.EXTRA_TITLE, videoTitle);
intent.putExtra("title", videoTitle);
activity.startService(intent);
}
/*Intent intent = new Intent();
try {
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(audioStream.url),
MediaFormat.getMimeById(audioStream.format));
intent.putExtra(Intent.EXTRA_TITLE, videoTitle);
intent.putExtra("title", videoTitle);
activity.startActivity(intent); // HERE !!!
} catch (Exception e) {
e.printStackTrace();
@ -317,6 +330,6 @@ public class ActionBarHandler {
builder.create().show();
Log.e(TAG, "Either no Streaming player for audio was installed, or something important crashed:");
e.printStackTrace();
}
}*/
}
}