android-videoview

Android Google Music app stops when my intro video plays

穿精又带淫゛_ 提交于 2019-11-29 08:44:54
I'm using a VideoView in my Android app to display the intro animation. If the Google Music App is playing music in the background, calling videoview.start() stops music playing in Google Music App in the background. Is there a way to make sure any music in the background will keep playing at the same time with my intro video? (it has no audio) Thank you! Turns out Google Music App and a few other apps will stop their music when any video starts playing. In order to make sure I'm not interrupting the listening experience for my users I now skip the intro video if I determine that there is

Couldn't open file on client side, trying server side Error in Android

可紊 提交于 2019-11-29 06:13:52
I have tried to play a youtube video by its URL by my android program. I have used setVideoURI(uri); function also to set URI, as suggested by other POSTs in stackoverflow regarding this. But I am getting Couldn't open file on client side, trying server side error. Can you please figure out what is the problem with my code. But I am able to play any local video by commented code. Here is my android code- public class VideoActivity extends Activity { //MediaPlayer song= new MediaPlayer(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Android VideoView Proportional Scaling

十年热恋 提交于 2019-11-29 05:45:53
In Android's VideoView, is there any way to achieve the same effect as ImageView.ScaleType.CENTER_CROP? That is, I want my VideoView to play the video such that it fills the entire screen without distortion. If the video aspect ratio does not exactly fit the screen's, then it should be cropped rather than distorted. The following solution will fill the screen, but does not maintain the video's aspect ratio: https://stackoverflow.com/a/6927300/1068656 And this solution maintains the video's aspect ratio, but will not fill the entire screen (video is scaled until the longer side hits the screen

How to play video from raw folder with Android device?

依然范特西╮ 提交于 2019-11-29 05:41:43
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.parse("android.resource://" + getPackageName() + "/" + R.raw.taipei); intent.setDataAndType(uri, type);

Android: Video View: how to play a video on a loop

拥有回忆 提交于 2019-11-29 04:55:10
问题 I got a simple dialog box with a VideoView in it and I want to play the video in a loop. I'm currently using a quick fix //Video Loop vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mp) { vv.start(); } }); but I would like to know if there is a better way? Edit I'm adding more code because I don't know how I can get access to the MediaPlayer object form the VideoView : String path = defaultPath+currentVideoRessource; if (path == null ||

Android VideoView crop_center

本秂侑毒 提交于 2019-11-29 04:08:21
I have a RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:foregroundGravity="center" android:gravity="center" android:orientation="horizontal" > <VideoView android:id="@+id/videoViewPanel" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:layout_centerInParent="true"/> </RelativeLayout> And what I need is to show video fullscreen cropped. If I could compare to ImageView, I need to

How can i play a video in chunks of bytes?

99封情书 提交于 2019-11-28 21:42:00
问题 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;

Put any View over a VideoView in Android

自作多情 提交于 2019-11-28 21:36:43
问题 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. 回答1: 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

Video doesn't loop Android VideoView

隐身守侯 提交于 2019-11-28 13:52:50
I am trying to build an android app that will loop a video! The problem is that it never loops! It plays the video only once! During debugging i realized that the "myVideoView.setOnCompletionListener" is being executed but the video doesn't play! I also try "mp.reset()" inside the CompletionListener. Maybe i am missing something in a different file, such as the Manifest? Any thoughts? Here is my code: final VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview); myVideoView.setVideoURI(Uri.parse(SrcPath)); myVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

is there a way to play streaming youtube video from my activity?

这一生的挚爱 提交于 2019-11-28 12:40:54
问题 Somewhere in my Android app I would like to play a youtube video, in my activity, in a small view. I'm trying to do this using VideoView , but no luck so far.. I wrote a simple activity, here is my code so far: public class MainView extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView = (VideoView) findViewById(R.id.VideoView); MediaController mediaController = new MediaController