I want to play a video giving fixed height and width, not whole screen.
Can anybody tell me how to play the video in a surface view on android? Please provide sample code
Thanks
Maybe a VideoView is what you want. I found some sample-code here.
Please try below:
surfaceholder.setFixedSize(width,height);
Related
My video datasource is 1920*1080, and my textureView is 622px * 540px. and I only want to display part of the video in the TextureView. How to do this? please help me , thanks.
I have solved it, i want it. https://github.com/dmytrodanylyk/video-crop/blob/master/library/src/com/dd/crop/TextureVideoView.java
I am using a mediaplayer on surfaceview and playing a video file. I dont want the video to be displayed but audio must be audible. Seen some of the questions and tried them, no help. Somebody please help.
Use a RelativeLayout and put an ImageView (with match_parent for width and height) above the SurfaceView in your layout. Set the source for the ImageView to a thumbnail and let the video play behind it (but not visible to the user).
i am using SurfaceView for play video and i want to get image from running video, i have tried with getDrawingCache() but i am getting blank image or Black screen but when i draw image of any other layout which dont have video then this is working fine,
so please anybody can solve this issue that How to get bitmap images from video or surfaceView. Thanks in advance please answer my question if you know.
I have used this code but not getting result.
mVideo.setDrawingCacheEnabled(true);
mVideo.buildDrawingCache();
Bitmap b = mVideo.getDrawingCache();
This won't work because the video content is not "exposed" to the normal view layers.
If you are using API Level >= 10 you can use MediaMetadataRetriever getFrameAtTime. It's described here.
Even this may not return the exact frame as it is fairly hardware dependent.
The most sure way to do this is to use something like FFMPEG to access the stream yourself.
I have developed an application in android which contains videos. Now I want to take screen shots from that running video. Is anybody having any idea regarding this thing.
Pleas provide some example code or links.
What you need is using MediaPlayer. Put SurfaceView to your layout and provide it to the MediaPlayer. After the playback is begun you will be able to get snapshot from SurfaceView.
If you want to take the screenshot of your full screen (with status bar and all) you cannot do that programatically unless you have a rooted phone. If you want the screenshot of your app only, then you can.
If you don't want it programatically, then you can-
Go to "Devices" view in eclipse and you have a screenshot (camera like) button there. You can find it from from Window -> Show View.
Try android-screenshot-library
these links may help you
capture screenshot of playing video and mailing that screen shot
http://code.google.com/p/android-screenshot-library/w/list
it worked for me
Assume your video view is inside a linearlayout, you can try:
linearlayout.setDrawingCacheEnabled(true);
linearlayout.buildDrawingCache();
Bitmap bm = linearlayout.getDrawingCache();
It can be easily view the doted rectangle over the video, so, please suggest how to get rid of these issue.. thank you for your concern