mirror of
https://github.com/danog/termux-api.git
synced 2024-11-27 04:14:47 +01:00
MediaPlayerAPI: check whether playback has been successfully started
This commit is contained in:
parent
7bdd53008a
commit
299d55789b
@ -205,7 +205,11 @@ public class MediaPlayerAPI {
|
||||
try {
|
||||
player.setDataSource(context, Uri.fromFile(mediaFile));
|
||||
player.prepareAsync();
|
||||
result.message = "Now Playing: " + mediaFile.getName();
|
||||
if (player.isPlaying()) {
|
||||
result.message = "Now Playing: " + mediaFile.getName();
|
||||
} else {
|
||||
result.error = "Failed to play: " + mediaFile.getName();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
result.error = e.getMessage();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user