1 | import android.app.*; |
2 | import android.media.*; |
3 | import android.net.*; |
4 | |
5 | // do not call in ui thread. |
6 | // waits until playback done. |
7 | |
8 | static void androidPlayMp3(Activity androidContext, File mp3) { |
9 | final MediaPlayer mPlayer = MediaPlayer.create(androidContext, Uri.fromFile(mp3)); |
10 | |
11 | final new Flag done; |
12 | mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { |
13 | public void onCompletion(MediaPlayer mp) { |
14 | mPlayer.release(); |
15 | done.raise(); |
16 | } |
17 | }); |
18 | |
19 | mPlayer.start(); |
20 | done.waitUntilUp(); |
21 | } |
Began life as a copy of #1001270
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001271 |
Snippet name: | androidPlayMp3 |
Eternal ID of this version: | #1001271/1 |
Text MD5: | bfe77de2836f623f2d741034b3363646 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-05-07 13:50:46 |
Source code size: | 546 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 653 / 956 |
Referenced in: | [show references] |