From d4660a3ce976b7427ef712e5818adf0e8a29d5a7 Mon Sep 17 00:00:00 2001 From: landfillbaby Date: Sat, 7 Apr 2018 00:29:28 +0100 Subject: [PATCH] MediaPlayerApi playHandler: prepare synchronously, don't always print failure the isPlaying() call was completing before the prepareAsync() call, always returning "Failed to play: " --- app/src/main/java/com/termux/api/MediaPlayerAPI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/termux/api/MediaPlayerAPI.java b/app/src/main/java/com/termux/api/MediaPlayerAPI.java index b1c1815..9d3e36c 100644 --- a/app/src/main/java/com/termux/api/MediaPlayerAPI.java +++ b/app/src/main/java/com/termux/api/MediaPlayerAPI.java @@ -204,7 +204,7 @@ public class MediaPlayerAPI { } try { player.setDataSource(context, Uri.fromFile(mediaFile)); - player.prepareAsync(); + player.prepare(); if (player.isPlaying()) { result.message = "Now Playing: " + mediaFile.getName(); } else {