android-videoview

How to determine video width and height on Android

时光毁灭记忆、已成空白 提交于 2019-12-09 04:08:35
问题 I have a video file and I want to get width and height of video. I don't want to play it, just to get size. I've tried to use MediaPlayer: MediaPlayer mp = new MediaPlayer(); mp.setDataSource(uriString); mp.prepare(); int width = mp.getVideoWidth(); int height = mp.getVideoHeight(); but it returns 0 for width and height, because VideoSizeChangedEvent didn't fire yet. How can I get width and height of video? UPD: I need API version 7 回答1: This works in API level 10 and up:

How to catch “Sorry, This video cannot be played” error on VideoView

社会主义新天地 提交于 2019-12-08 23:35:54
问题 I have a VideoView and I am streaming videos from a remote server. Most of the times It would play the videos very smoothly. But sometimes, it displays an error message "Sorry, This video cannot be played". I have a hunch that this is more on the supported video formats. However, I don't know which are the supported formats. My question is "How can I catch this error (e.g. Prevent the error message from appearing)"? I am using Android 2.2 on this project. Any advice would be greatly

VideoView in a live wallpaper?

元气小坏坏 提交于 2019-12-08 15:28:39
问题 As per other questions android-video-as-a-live-wallpaper, is the only way to play a video in a live wallpaper is to decode it yourself? 回答1: Just use MediaPlayer instead of VideoView and use MediaPlayer.setSurface instead of MediaPlayer.setDisplay. If you use setDisplay the MediaPlayer trys to tell the SurfaceHolder to keep the screen on which isn't allowed for LiveWallpapers and will throw an error. I use WebM/vpx8 video but this should work with whatever MediaPlayer supports (just put the

How to Load Video Thumbnail From Video Url in ListView adapter

雨燕双飞 提交于 2019-12-08 13:28:48
问题 I have a ListView and I want to populate it with video form a URL. I can show Pictures in ListView adapter easily from URL, but how to load a video thumbnail? 回答1: You can use MediaMetadataRetriever to get your video thumbnail. new AsyncTask<Void, Void, Bitmap>() { @Override protected Bitmap doInBackground(Void... params) { Bitmap bitmap = null; String videoPath = "http://techslides.com/demos/sample-videos/small.mp4"; MediaMetadataRetriever mediaMetadataRetriever = null; try {

OpenCV's native camera in Android prevents video player from working

半世苍凉 提交于 2019-12-08 12:18:12
问题 I'd like to play a video file in android (using VideoView and MediaController) while enabling the camera to capture images. No camera display or preview is required. However, if I invoke "openCamera" (instantiate a new VideoCapture), the application fails and informs that: video cannot display. If I remove the call to instantiate the camera, the video plays smoothly. public class Myvideoplayer extends Activity { public FrameLayout imageFrame; public RelativeLayout imageFrameLayout; private

VideoView Streaming: Audio works but video is black

℡╲_俬逩灬. 提交于 2019-12-08 12:13:52
问题 I have a very strange issue. I am using a steam video and I play it on my app but the issue is that Audio works but video is not working. It shows a black screen (See image for reference.) I have no idea what the issue is. Audio works fine but video shows black screen. Any ideas of what the issue can be? Here is my code for reference: public class Video_Low_Mission extends Activity { // Put in your Video URL here private String VideoURL = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov";

Android Video Recording using Media Recorder is Not working

拟墨画扇 提交于 2019-12-08 11:21:10
问题 I am trying to Record a Video, But It's getting crash at Media Record starts and Media Record Prepare .please Help Me... Here Is My Code... private boolean startRecording() { camera.unlock(); try { mediaRecorder = new MediaRecorder(); mediaRecorder.setOnErrorListener(new MediaRecorder.OnErrorListener() { @Override public void onError(MediaRecorder mr, int what, int extra) { Log.i(TAG, "Error"); } }); second=0; minute=0; recordCountTimer = new CountDownTimer(Long.MAX_VALUE,1000) { @Override

How to play partial mp4 file in android

大城市里の小女人 提交于 2019-12-08 09:12:53
问题 i am stuck in a weird situation, as i am developing an android app which decrypts video at run time and plays it. Decryption process is already optimized and i am using RC4 algorithm and nio channel for copying but problem is that, it still takes about 1 min 10 secs for 250mb video and my client wants it maximum 15 secs. I am thinking about a solution in which i play my video while its getting decrypted and copy but its not happening i am getting error can't play this video. I am using

Nested Fragment with VideoView streaming takes too long while stopping

这一生的挚爱 提交于 2019-12-08 04:39:11
问题 I have a tab UI, with a Fragment Tab host at bottom and fragments in a container fragment. Every time I change Tab I switch between fragments within the container fragment. Now the issue is as below: I have a fragment with a video view streaming live video. while the video is buffering if I press back key the fragment takes too long to stop. I can see a big lag of 2-3 seconds from the time onStop() of this fragment till oCreateView() of other fragment. All my other methods like onDestroy,

streaming a webcam feed over rtsp using ffmpeg & ffserver to an android client

淺唱寂寞╮ 提交于 2019-12-08 04:16:00
问题 I am trying to stream my webcam over rtsp and open the stream using android. I managed to get the first part working (rtsp stream) using ffserver and ffmpgeg. Here is my ffserver.conf file : HTTPPort 8000 RTSPPort 8001 HTTPBindAddress 192.168.1.74 RTSPBindAddress 192.168.1.74 MaxClients 100 MaxBandwidth 10000 NoDefaults <Feed witty.ffm> File /tmp/witty.ffm FileMaxSize 20M </Feed> <Stream witty.mov> Feed witty.ffm Format rtp VideoSize 640x480 VideoQMin 1 VideoQMax 20 VideoFrameRate 30