Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onClick(View v) {
- Intent in = getIntent();
- String filename = in.getStringExtra(KEY_FILENAME);
- if(v.getId() == R.id.ButtonTestPlayPause){
- try {
- String AUDIO_PATH = "http://91.73.25.212:8080/imap/attachments/"+filename;
- String username = "admin";
- String password = "admin";
- String userpassword = username + ":" + password;
- byte[] authEncBytes = Base64.encodeBase64(userpassword.getBytes());
- String authStringEnc = new String(authEncBytes);
- URL url = new URL(AUDIO_PATH);
- URLConnection urlConnection = url.openConnection();
- urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);
- Toast.makeText(getApplicationContext(),"play", Toast.LENGTH_LONG).show();
- mediaPlayer.setDataSource(AUDIO_PATH);
- mediaPlayer.prepareAsync();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement