Android VideoView display my Video but Rotated - android

In my application I need to record a video, view the recorded video then submit it to the server.
Recording Video is working fine.. and the video saved to my android device..
When I go to another activity to view the video, the video displayed to me with different rotation (like if it was rotated by 90). while the video saved on my device is not rotated.
My Code:
captureVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
captureVideoIntent.putExtra("android.intent.extra.durationLimit", 30);
startActivityForResult(captureVideoIntent, VIDEO_CAPTURED);
onActivityResult, I saved the video Uri
... mgr.videoFileUri = data.getData(); .....
Activity to Display the Video (with other fields):
video = (VideoView) findViewById(R.id.VideoView);
video.setVideoURI(mgr.videoFileUri);
video.setMediaController(new MediaController(this));
video.requestFocus();
video.start();

Related

How to play video using software like on MX player?

I have troubled in playing a video that is not supported by hardware I want to create a simple video player that can play any video even it is not supported by hardware. I like the way how mx player did it. Can any one help me how to play a video like in MX player. I have this basic syntax but it only plays hardware supported videos. Here's my code
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri = uri = Uri.parse("android.resource://" + getPackageName() + "/"
+ R.raw.videointro);
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
You need to write intent and for that please pass the video url. Then android will identify apps which will able to play video then you need to pick/select one.

Recording video with mediaplayer

Creating an app. I want to have the app play video from my sdcard, without having to change the code every time. I want to be able to choose from any video on my phone, is this possible and if it is would you mind sharing code.
this is what i have
setContentView(R.layout.activity_play);
VideoView videoView=(VideoView)findViewById(R.id.videoView1);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
//Uri video = Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath()+"filename");
Uri video =Uri.parse("sdcard/KVID0023.mp4");
videoView.setVideoURI(video);
videoView.setMediaController(mediaController);
videoView.start();

disabling video controls in ACTION_VIEW

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.

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.

how to fetch correct URL to video

im trying to play a video in VideoView on an android application.
the question is how do i fetch the correct link to the video from youtube and not just the webpage?
setContentView(R.layout.videopopup);
VideoView vv = (VideoView)findViewById(R.id.videoElem);
MediaController mc = new MediaController(this);
mc.setEnabled(true);
mc.show(0);
vv.setMediaController(mc);
vv.setVideoURI(Uri.parse("http://www.youtube.com/v/oFL2rszPmmU?version=3&feature=player_detailpage"));
vv.requestFocus();
vv.showContextMenu();
vv.start();
in this link: Video View not playing youtube video
Evgeny Nacu explains which link it should be, but not how to retrieve it from a given youtube page.
Simple way to play video using default youtube app:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(your youtube url);
Youtube app will do everything. You need not do anything.
and if that doesn't solve, use webview instead of videoview in your code

Categories

Resources