android-videoview

How Do I Play Video in ListView like Instagram and Vine?

て烟熏妆下的殇ゞ 提交于 2019-12-04 02:54:17
I'm new to android development and I am trying to play multiple videos in a listview. Currently, each listview row item is a VideoView. This approach has not worked as the VideoViews act abnormally when I begin to scroll. I've researched here , here , here and discovered that VideoViews and TextureViews don't work well within ListViews and ScrollViews. How are apps like vine and instagram able to play videos in listviews? Any help is greatly appreciated? Although the answer is late but i think it might help someone searching for the same. There is a sample app from the github that has

Android 4.2 with 4 MediaPlayers = “Can't play this video”

我与影子孤独终老i 提交于 2019-12-04 01:07:39
问题 Whenever I'm trying to load at least 4 mediaPlayers, one of them will corrupt the video it's trying to load and trigger an Android OS message "Can't play this video" Other information: For 3 mediaPlayers everything works fine. On other Android versions, different from 4.2, the same code with the same 4 video works. The 4 video can be played independently on the device. There is no format problem. After starting the program and getting the "Can't play this video" message, the video can no

Using VideoView, how to remove “can't play this video” alert message?

牧云@^-^@ 提交于 2019-12-03 23:31:40
Our app plays a set of videos, sometimes we are getting can't play this video alert message. We are either playing video from sd card or streaming if that video is not yet downloaded. Mostly, error arises while streaming with slow internet connection. I understood few causes of this error from reading some posts and blogs. But, now I want to play the next video when the error occurs without showing that error message. I used the below listener for that , video.setOnErrorListener(new OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.d("video",

Get the mediaPlayer of the videoView in Android

随声附和 提交于 2019-12-03 22:38:31
Is it possible to get a reference to the mediaPlayer instance that the videoView is using, preferably right inside its ctor? If so, how? Since the videoView doesn't have as much listeners as the mediaPlayer, I would like to have the ability to reach the mediaPlayer for extra control and better events handling. you can listener from VideoView. VideoView mVideoView=new VideoView(); mVideoView.setOnPreparedListener( new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer pMp) { //use a global variable to get the object } }); Alternatively if you are only interested on

Android WebView html5 video force fullscreen

纵饮孤独 提交于 2019-12-03 22:33:31
I have been working on this issue for at least one week. I have read all the post about it in StackOverflow but I still not founding the solution and I am starting to think that this is impossible. I want to display an HTML in a webview embebbed in a layout like this: The problem is that if that HTML code has an HTML5 video inside it will be cropped due to a bug in Android OS: Link to bug . I have tried many workarounds but none of them seems to be working. My last attempt is to show the video on fullscreen for devices lower than Jelly Bean (they have fixed the error for this version). I do

Android - Different ways of playing video

与世无争的帅哥 提交于 2019-12-03 20:47:05
I just came across the limitation of VideoView of not being able to play mp4 video files that are wider than 320 pixels. I was wondering how can we overcome these limitations. I am trying to make my app as forgiving as possible, so other than using VideoViews is there another way to play these mp4 videos? Chris I am not aware of a 320px wide limit on VideoView , though I haven't tried it. You can use MediaPlayer and a SurfaceView to play back videos. In fact, that's pretty much all VideoView is. Last I looked at the VideoView source code, it was only ~200 lines. Here is a sample project that

How to set the preview image in videoview before playing

核能气质少年 提交于 2019-12-03 18:26:06
问题 I created an VideoView in my activity, below is the code. VideoView vvVideos = (VideoView) rootView.findViewById(R.id.videoView); MediaController mediacontroller = new MediaController(ctx); mediacontroller.setAnchorView(vvVideos); Uri video = Uri.parse("android.resource://" + packageName +"/"+R.raw.sample); vvVideos.setMediaController(mediacontroller); LayoutParams params=vvVideos.getLayoutParams(); params.height=150; vvVideos.setLayoutParams(params); vvVideos.setVideoURI(video); vvVideos

How to play video in VideoView?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 16:19:45
I want to play video in VideoView . When I try to do that I got the following error: Here is my source code: package com.video.listitem; import android.app.Activity; import android.content.pm.ActivityInfo; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.widget.MediaController; import android.widget.VideoView; public class PlayVideo extends Activity { VideoView mVideoView; MediaController mc; String videourl; @Override protected void onCreate(Bundle savedInstanceState) { super

VideoVideo - Video Width x Height- MediaPlayer Issue

自作多情 提交于 2019-12-03 16:03:07
I have written a sample app that reproduces the problem: https://github.com/blundell/VideoRatioProblemPerDevice The VideoView documentation states: Displays a video file. ... takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling The problem is the Samsung Galaxy S3 is doing weird things to the video and not respecting the ratio of the video. (also happening on an HTC device). Activity with full screen fragment: What I have found is when the video is played on the Samsung Galaxy S3 it will play

Trouble getting video to play on Recyclerview

孤人 提交于 2019-12-03 13:27:20
问题 I have a VideoView inside a RecyclerView. I want to eventually have a list of videos to play on a Recyclerview. I decided to start out with one video, then move on to having multiple videos. I can't seem to get one video to play in the Recyclerview. When I start the app on my phone, all I get is the progress bar. The onPrepared function is never called for some reason. Here's my code. RecyclerActivity.java import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import