mediacontroller

Android: How to use mediaController in service class?

淺唱寂寞╮ 提交于 2019-11-28 01:40:20
问题 I have a app that plays radio via MediaPlayer as a service. Is it possible to use MediaController in Service class? The problem is that I can use findViewById. I try to get my LinearLayout in onPrepeared methiod ... public class RadioPlayer extends Service implements OnPreparedListener, MediaController.MediaPlayerControl { @Override public void onCreate() { super.onCreate(); mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer

Extending MediaController for android

拈花ヽ惹草 提交于 2019-11-27 23:17:59
I am using a VideoView and the MediaController for an app I am working on. I simply wanted to have the MediaController appear on top of my VideoView but apparently you can't do that very easily. I attempted to use the setAnchorView method to my VideoView id, but that didn't work. No matter what I do, the MediaController is always at the bottom of my screen. With that said, I did some research and it looks as if I go about extending MediaController , I can change position and other properties. I have created a new class: package com.dop.mobilevforum; import android.content.Context; import

Media player using YouTube?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 21:37:52
I am developing a sample application using MediaPlayer .By using the raw resources folder,the video can be played.But I want to play through URL .How can I achieve this? My code is: VideoView videoView = (VideoView) findViewById(R.id.VideoView); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); // Set video link (mp4 format ) Uri video = Uri.parse("http://www.youtube.com/watch?v=T1Wgp3mLa_E"); videoView.setMediaController(mediaController); videoView.setVideoURI(video); videoView.start(); bettlebrox You need to get the correct streaming(rtsp)

Android back button and MediaController

孤人 提交于 2019-11-27 13:31:38
I know how to take control of the back button. I have a VideoView embedded in a FrameLayout . My question is when the video pops up, the video controls are present for a few seconds. Hitting the back button while they are visible hides the video controls. Is there a way to ignore that function and do the next back action as if the video controls weren't visible? The reason I ask is if I really do want to go back, I must hit the back button twice; once to hide the controls and second to actually go back Based on the source code, this should work: Extend MediaController (for the purposes of this

Android MediaController intercepts all other touch events

佐手、 提交于 2019-11-27 07:41:51
问题 The top half of my app has a VideoView with a MediaController under it. The bottom half is an image with some buttons. While the MediaController is visible, the buttons below are not clickable. It's like while the MediaController is visible, it intercepts all other touch events, even if they are not within the bounds of the MediaController . Any idea around that? 回答1: You can check out my answer on overriding dispatchTouchEvent() to pass clicks through MediaController to an underlying Button

Media player using YouTube?

江枫思渺然 提交于 2019-11-27 04:31:34
问题 I am developing a sample application using MediaPlayer .By using the raw resources folder,the video can be played.But I want to play through URL .How can I achieve this? My code is: VideoView videoView = (VideoView) findViewById(R.id.VideoView); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); // Set video link (mp4 format ) Uri video = Uri.parse("http://www.youtube.com/watch?v=T1Wgp3mLa_E"); videoView.setMediaController(mediaController);

how to create custom UI for android MediaController

感情迁移 提交于 2019-11-26 17:01:55
I want to customize the controls in the MediaController for my video player. I want to swap out the image for the play button, change the skin, change the color, ect. Is there a known way of doing this? Thanks I had the same problem on a recent project and ended up creating a custom implementation based on the stock MediaController. It adds a fullscreen button at the far right, but even if that's not what you want this class should be a good starting point. Code: VideoControllerView.java - http://pastebin.com/1V63aVSg media_controller.xml - http://pastebin.com/rS4xqMej Image resources: Gotchas

Android back button and MediaController

萝らか妹 提交于 2019-11-26 16:23:22
问题 I know how to take control of the back button. I have a VideoView embedded in a FrameLayout . My question is when the video pops up, the video controls are present for a few seconds. Hitting the back button while they are visible hides the video controls. Is there a way to ignore that function and do the next back action as if the video controls weren't visible? The reason I ask is if I really do want to go back, I must hit the back button twice; once to hide the controls and second to

How to put media controller button on notification bar?

烂漫一生 提交于 2019-11-26 15:54:24
I am creating a music player application. I want to show the media controller on notification bar while my application is running in background. It looks like Google player. How to do this? Roadies For getting media player controller in your app simply follow this: Call this method in your MainActivity public void showNotification(View view){ new MyNotification(this); finish(); } Create a new MynotificationClass public class MyNotification extends Notification { private Context ctx; private NotificationManager mNotificationManager; @SuppressLint("NewApi") public MyNotification(Context ctx){

Event for VideoView playback state or MediaController play/pause

牧云@^-^@ 提交于 2019-11-26 12:38:47
问题 I cant seem to find an event that listens for playback state. I am mostly interested in the play/pause state. I am using MediaController which has a Play/Pause button, but I have a secondary button that also controls Play/Pause . Using my custom button, I can play/pause , but if I play/pause using the MediaController play/pause button, I currently have no way to change the image on my custom play/pause button to either play or pause. Is there an event that I do not know about so I can do some