android-videoview

Video is not pausing in fragment ViewPager

别来无恙 提交于 2019-11-30 09:15:39
I am using View Pager with fragment to showing image and video, I am able to show image and video properly but I have problem, when I swipe for video, then video is playing, but I swipe next or previous then video is still playing on just next or previous screen but when I move two slide next or previous then video is being stop, but why not on next or previous slide. I search it more but I did not get any solution, any help will be appreciable. Thanks in advance. Here is my code: This is Fragment Class public class ContentFragment extends Fragment { private final String imageResourceId;

How to play videos from SD Card

妖精的绣舞 提交于 2019-11-30 08:00:36
问题 I was creating a simple app which stream videos from net and I made it but now I want to change the code so that I can play video files from my SDCard original code: Uri vidFile = Uri.parse("MY SITE HERE"); VideoView videoView = (VideoView) findViewById(R.id.VideoView); videoView.setVideoURI(vidFile); videoView.setMediaController(new MediaController(this)); videoView.start(); So please help me with changing the code so that it can play videos from my mobile memory card. 回答1: The videoView

How to play video from raw folder with Android device?

女生的网名这么多〃 提交于 2019-11-30 07:54:56
问题 Please help, How to play videos in android device from raw folder for offline mode? Successful example1: I can play the video from SDcard used the below code. Intent intent = new Intent(Intent.ACTION_VIEW); String type = "video/mp4"; Uri uri = Uri.parse("file:///sdcard/test.mp4"); intent.setDataAndType(uri, type); startActivity(intent); Failed example2: Question: May I put the test.mp4 to res/raw folder? Intent intent = new Intent(Intent.ACTION_VIEW); String type = "video/mp4"; Uri uri = Uri

Android VideoView - How to play videos in sequence

混江龙づ霸主 提交于 2019-11-30 04:22:31
问题 I'm trying to develop an android application that plays more than one video in one videoview. When one is finished, the second has to start and so on. My videos are stored in the raw folder of the project, to get their filenames i do: Field[] fields = R.raw.class.getFields(); final List<String> videoNames = new ArrayList<String>() ; for(Field field: fields){ videoNames.add(field.getName()); } then i set the first one's path to my video view videoUri = Uri.parse("android.resource://" +

Android VideoView Cannot play video mp4

白昼怎懂夜的黑 提交于 2019-11-30 03:13:20
问题 I used the Android VideoView to play a video file via HTTP. My problem is my phone prompts "Cannot play video Sorry, this video cannot be played." when playing a mp4 file from HTTP. But it is ok when playing another mp4 video file. When used in a newer phone, like Samsung Galaxy S, my program can play both mp4 video file from HTTP successfully. My phone: Samsung GT-S5830 Android version: 2.3.4 Display: 320x480. Video file 1 (OK): Video Codec: H.264 Resolution: 640x360 Others: 16:9, 340kbps,

How to detect if VideoView is playing video or Buffering?

五迷三道 提交于 2019-11-30 02:56:26
问题 How to detect if VideoView is playing video or Buffering? I want to display a pop-up saying video is buffering. In android API level 17 there is a call back setOnInfoListener that can provide me this information but i am using API level 15 (android ICS). I have also seen this question "Detect if a VideoVIew is buffering" but the suggested solution is for MediaPlayer and not for VideoView . SO how can I detect if VideoView is buffering? is it a good solution to run a thread to check the

Resume playing VideoView from onResume

时光总嘲笑我的痴心妄想 提交于 2019-11-30 01:56:54
I have a VideoView and it is pause when I start an Email intent. When the email intent is done, I want the videoView to continue playing, however, it restarts from the beginning. @Override public void onPause() { Log.d(TAG, "onPause called"); super.onPause(); videoView.pause(); } @Override public void onResume() { super.onResume(); Log.d(TAG, "onResume called"); videoView.start();//resume() doesnt work } How can I get the videoView to resume from where it left off. iTurki What about this: @Override public void onResume() { super.onResume(); Log.d(TAG, "onResume called"); videoView.seekTo

How can i play a video in chunks of bytes?

 ̄綄美尐妖づ 提交于 2019-11-30 00:55:53
I want to play a video in android,which i had saved in my assets folder. I have changed it into a byte array and it is playing successfully,using the below code private String getDataSource() throws IOException { InputStream stream = getAssets().open("famous.3gp"); if (stream == null) throw new RuntimeException("stream is null"); File temp = File.createTempFile("test", "mp4"); temp.deleteOnExit(); String tempPath = temp.getAbsolutePath(); int totalRead = 0; int bytesToRead = 1 * 1024; FileOutputStream out = new FileOutputStream(temp); byte buf[] = new byte[128]; int numread = 0; do { numread =

Put any View over a VideoView in Android

柔情痞子 提交于 2019-11-30 00:51:59
It is possible to put any view over a VideoView? (I.e. put the control buttons over the video, like in vimeo). I'm trying to do it using FrameLayout, but I have not found the way, and I'm still not sure if what I'm trying to do something that's is simply not possible. I do this sort of thing with FrameLayout. What you need to do is make sure that the controls are below the VideoView in the Layout Editor. <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android

Is it possible to place one view over another in android?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 00:17:45
问题 Can we place a small view over another large view? For example, I have a VideoView which is playing a file in the background. Over this, somewhere in the middle/corner, I want to place another ImageView. But in Linear/Relative Layout, views can be placed only one after another or relative to each other, and AbsoluteLayout is advised against. So what do I do? 回答1: FrameLayouts let you pile each view on top of the one below. This can also be achieved with a RelativeLayout . 回答2: The FrameLayout