mediacontroller

Android mediacontroller Play Pause controls not refresh properly

三世轮回 提交于 2019-12-09 10:43:23
问题 I have used MediaController in my activity its working fine but when I play video for first time then there should b pause button visible but instead there is play and when I press that button then the video is paused correctly and state remains the same and after that its working properly. And same thing happens when Video Completed. Is this a bug or I am doing any thing wrong? videoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) {

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

How to get the Height of the VideoView included in the Activity

时间秒杀一切 提交于 2019-12-08 04:02:43
问题 I need to get the Height of the VideoView of my activity in android, I am using the following commands, but it gives me the Height as 0. VideoView vv = (VideoView)findViewById(R.id.video1); String surl="SOME_LINK.mp4"; Uri uri=Uri.parse(surl); MediaController mc = new MediaController(this); vv.setVideoURI(uri); vv.setMediaController(mc); mc.setMediaPlayer(vv); mc.setAnchorView(vv); int vvHeight=vv.getMeasuredHeight(); Log.d("VideoView Height:",vvHeight+""); // The Logcat output : 0. int

I want to get the video size in MB from videoview from internet path

空扰寡人 提交于 2019-12-07 13:37:01
问题 I'm trying to get the video file size and display it in the layout before starting the video. I have tried many thing but it wont work video_player_view = (VideoView) findViewById(R.id.videoView2); media_Controller = new MediaController(this); dm = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(dm); int height = dm.heightPixels; int width = dm.widthPixels; try { video_player_view.setMinimumWidth(width); video_player_view.setMinimumHeight(height); } catch

How can I set transparency of MediaController background in android

前提是你 提交于 2019-12-06 09:28:56
I want to set the transparency of MediaController background and not controls. I tried using mediaController.setAlpha(0.6f), but it is applying transparency to controls as well like this try setting the background color with a transparent color instead of alpha. For example, with color hex #99CC00: In your colors.xml : <resources> <color name="NoTransparent">#FF99CC00</color> <color name="AlmostTransparent">#4499CC00</color> <color name="FullTransparent">#0099CC00</color> </resources> Then in your activity: mediaController.setBackgroundColor(getResources().getColor(R.color.AlmostTransparent));

I want to get the video size in MB from videoview from internet path

99封情书 提交于 2019-12-06 01:24:13
I'm trying to get the video file size and display it in the layout before starting the video. I have tried many thing but it wont work video_player_view = (VideoView) findViewById(R.id.videoView2); media_Controller = new MediaController(this); dm = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(dm); int height = dm.heightPixels; int width = dm.widthPixels; try { video_player_view.setMinimumWidth(width); video_player_view.setMinimumHeight(height); } catch (Exception e) {} video_player_view.setMediaController(media_Controller); video_player_view.setVideoPath(path);

Make MediaController show without hide

时光总嘲笑我的痴心妄想 提交于 2019-12-05 01:19:31
问题 I try to use MediaController to play music. I want the MediaController appear until the "back" button is pressed. Now I have try below code: MediaController mediaController = new MediaController(this){ @Override public void setMediaPlayer(MediaPlayerControl player) { super.setMediaPlayer(player); this.show(); } @Override public void show(int timeout) { super.show(0); } //instead of press twice with press once "back" button to back @Override public boolean dispatchKeyEvent(KeyEvent event) { if

MediaController Positioning - bind to VideoView

家住魔仙堡 提交于 2019-12-04 18:18:53
问题 There have been a lot of discussions about how to position a MediaController and most answers are to use the setAnchorView -Method. At the first glance this solution seems to work but in my case it doesn't. According to this Post setAnchorView only acts as a reference for initial positioning of the MediaController , but actually creates a new floating Window on top. So what I want is a MediaController that is really bound to a parent View (e.g. VideoView). For example if you have a

Android remove Fastforward and rewind buttons from mediaplayer

孤人 提交于 2019-12-04 06:28:29
I would Like to remove the fastforward and rewind buttons from mediacontroller in Android. Can anyone help me with this? I want to do it inside my main activity. When creating a MediaController, make sure to set the boolean to false in the constructor: MediaController mediaController = new MediaController(this, false); From the documentation : The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false If you're trying to remove the buttons from a MediaPlayer than is not part of your app,

Using MediaController on Android 5

人走茶凉 提交于 2019-12-03 20:21:37
问题 I want to use the new MediaController in Android 5 instead of the old RemoteController for getting the currently playing track and changing the track. I couldn't find any examples so I tried it by myself. To get the current MediaController , I have implemented a Class which extends MediaController.Callback and implements MediaSessionManager.OnActiveSessionsChangedListener . With this method I try to get the current mediaController : @Override public void onActiveSessionsChanged(List