disabling video controls in ACTION_VIEW - android

Hi My Question is want to disable or not to show the video controls if i use ACTION_VIEW for any videos. Do i need to specify any extras for Intent or is there any proper way to achieve this
below is the code for reference
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(appnamesArray[arg2]));
Any Sample links or code helps me a lot
Thanks in Advance
EDIT:
As i understood that action_view starts the default player or user selected player so the controls goes to player and intent has no control to hide it for that i used videoview to show the video from url
VideoView videoView = (VideoView) new VideoView(getApplicationContext());
MediaController mediaController = new MediaController(MainActivity.this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(appnamesArray[arg2]);
videoView.setMediaController(null);
videoView.setVideoURI(video);
videoView.start();
setContentView(videoView);
please update me if any one can able to succeed this by doing the ACTION_VIEW itself

If you use the view intent it will have option to open video in all the players that support it. So even if some of the players support hiding controls other might not.
Best solution is to have your own video view.

Related

Display subtitle with Android Media Player?

I am using this snippet to open a video using default Android Video Player:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://my.video/link.mp4"), "video/mp4");
startActivity(intent);
Now I want to display subtitle on the video, my subtitle is provided with a url, example http://my.subtitle/link.srt. I think there would be something simple like this:
intent.putExtra("subtitle", "http://my.subtitle/link.srt");
But it doesn't seem to be simple like that.
Could anyone show me how to do it? Thanks a lot.

Playing RTSP links in Android

I have a list of video links where some are http:// and some are rtsp://.
So, I created a method that invokes the native view in android to play the video. it works well with http but it is failing for the rtsp. Actually, It is giving me an error that is not helping either knowing that rtps is a supported media format (http://developer.android.com/guide/appendix/media-formats.html)
String url = (String) v.getTag();
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse(url);
intent.setDataAndType(data, "video/*");
startActivity(intent);
Any ideas?
RTSP is a communication protocol extremely affected by firewalls, the fact that http works fine and rtsp is not, means that your firewall might be blocking that content and the rtsp feed you are getting might be configured to use UDP, in order to make sure that you are getting the rtsp data properly you should change your router configuration to not block that info, remember that rtsp can use UDP or TCP as transport layers and gets affected by the security system accordingly.
Hope this helps.
Regards!
try this code :
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
mediaController.setMediaPlayer(videoView);
Uri video = Uri.parse("your_RTSP_link");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();

Android Capture Video and play

I want my application to Record a video and play on VideView in android. I am doing this for that.
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
context.startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);
// context is an Activity's context
And overriding onActivityResult() as
Uri mVideoUri = data.getData();
videoView.setVideoUri(mVideoUri);
videoView.setMediaController(new MediaController(this));
videoView.requestFocus();
But Its not playing the recorded video, I also tried by using
videoView.setVideoPath(mVideoUri.getPath());
instead of Uri, but nothing happened except one change that, it show this video cannot be played.
I fixed this issue, i just made a silly mistake that i didn't invoke videoView.start() Method.

android: using default video player

I have an application that plays video files.
I have been using code for using Videoview and starting the Videoview manually to play video files. However, I just wanted to know if I can use the default media player or video player of android rather than creating or using the VideoView to play the file..
Please make comments if the question is not clear.
Thanks alot
Sure - just use an Intent with the file Uri.
File file = new File("fileUri");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "video/*");
startActivity(intent);

Play audio files with default player

I want to play an MP3 file using the default Android player. I managed to get the file playing but it plays in the background. I want to have all the nice controls for pausing, playing, etc.
My code now is something like:
String link = "http://www.example.com/file.mp3";
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(link);
mp.prepare();
mp.start();
How can I do it that when this file begins to play to go to another screen with the player and all the nice controls?
The MediaPlayer class should be used when you want to implement your own media player. If you want to use an existing player, you'll have to launch the appropriate intent, for example:
Uri uri = Uri.parse("http://www.site.com/file.mp3");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
If the particular Action doesn't work, take a look here: http://developer.android.com/reference/android/content/Intent.html

Categories

Resources