Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. AuthType Basic
  2. AuthUserFile /home/domains/.htpasswd
  3. require valid-user
  4. AuthName "Protected directory"
  5.  
  6. MediaPlayer mediaPlayer=new MediaPlayer();
  7.  
  8. Context context=getContext();
  9. Uri myUri1 = Uri.parse("http:/user:password@xyz.com/uploads/ABC.mp3");
  10.  
  11. try {
  12. mediaPlayer.setDataSource(context, myUri1);
  13. } catch (IllegalArgumentException e) {
  14. Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
  15. } catch (SecurityException e) {
  16. Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
  17. } catch (IllegalStateException e) {
  18. Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
  19. } catch (IOException e) {
  20. e.printStackTrace();
  21. }
  22. try {
  23. mediaPlayer.prepare();
  24. } catch (IllegalStateException e) {
  25. Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
  26. } catch (IOException e) {
  27. Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
  28. }
  29. mediaPlayer.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement