Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AuthType Basic
- AuthUserFile /home/domains/.htpasswd
- require valid-user
- AuthName "Protected directory"
- MediaPlayer mediaPlayer=new MediaPlayer();
- Context context=getContext();
- Uri myUri1 = Uri.parse("http:/user:password@xyz.com/uploads/ABC.mp3");
- try {
- mediaPlayer.setDataSource(context, myUri1);
- } catch (IllegalArgumentException e) {
- Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
- } catch (SecurityException e) {
- Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
- } catch (IllegalStateException e) {
- Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- mediaPlayer.prepare();
- } catch (IllegalStateException e) {
- Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
- } catch (IOException e) {
- Toast.makeText(context, "You might not set the URI correctly!", Toast.LENGTH_LONG).show();
- }
- mediaPlayer.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement