seekbar

MediaPlayer与SeekBar关联绑定的原理

匿名 (未验证) 提交于 2019-12-03 00:11:01
1.MediaPlayer播放后会自动更新播放进度,SeekBar需要根据MediaPlayer的播放进度更新进度条。 2.SeekBar的进度条更新后,需要更新MediaPlayer的播放进度。 3.使用Timer、TimerTask,每10ms根据MediaPlayer的播放进度更新一次SeekBar的进度条。 MediaPlayer需要用到的相关方法: A.获取音乐长度:getDuration() B.获得现在播放的位置:getCurrentPosition() C.调整播放的位置:seekTo(int msec) SeekBar需要用到的相关方法: A.设置进度条的最大长度:setMax(int value) B.设置滑块的位置:setProgress(int value) C.设置SeekBar的进度改变事件:setOnSeekBarChangeListener(OnSeekBarChangeListener l) 来源:51CTO 作者: PErryiii 链接:https://blog.csdn.net/PErryiii/article/details/101214918

android自定义EditText,Button和Seekbar简单用法(shapeDrawable)

匿名 (未验证) 提交于 2019-12-02 23:51:01
系统提供的控件有时候并不能满足我们的需求,因此我们使用自定义控件,下面介绍Button高亮 ,Edittext的高亮,自定义Seekbar,Edittext的风格,并介绍ShapeDrawable! 1.Button点击高亮 当我们点击button按钮时,button按钮的颜色应当发生变化,不然用户不确定自己点击的button是否生效,我们选择两种颜色,一种是正常状态下的红色,一种是点击状态下的深红色,在drawable目录下新建一个xml文件,代码如下: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!--当点击button按钮时,button的颜色--> <item android:state_pressed="true" android:drawable="@color/c1"></item> <!--当未点击button按钮时,button的颜色--> <item android:state_pressed="false" android:drawable="@color/c10"></item> <!--state_press="true|false"是确定按钮是否被点击--> <!-

Mediaplayer progress update to seekbar not smooth?

こ雲淡風輕ζ 提交于 2019-12-02 18:22:02
I am working on an app with recorder and player. I am using mediaplayer to play the recorded .wav file and meantime I want to update to a seekbar. Everything is working fine But my problem is mediaplayer progress updation to seekbar is not happening smoothly, If we are playig a small file, thumb of the seekbar jumps in seconds or between. Can anyone help me with a workaround to make it smooth seeking of the progress in seekbar. My code is shown below.I am totlay stuck here. mediaPlayerIntiate(); mediaPlayerSetSource(); mMediaPlayer.start(); task = new TimerTask() { @Override public void run()

使用IJKPlayer播放视频实现了一些播放视频的基本操作

て烟熏妆下的殇ゞ 提交于 2019-12-02 14:44:23
使用IJKPlayer播放视频实现了一些播放视频的基本操作 Iijkplayer目前是很流行的音视频框架,集成我这里就不多说了,网上很多,大概就是编译ijkplayer的源码得到里边的so文件,添加到自己项目的libs文件夹中,gradlle依赖下资源。我这里是在IjkVideoView基础上开发的, 自己实现了播放、暂停、旋转全屏播放、音量和亮度调节、进度条、拖动进度条播放功能 ,可以满足普通的播放视频的需求; Demo下载 友情提示我播放的是本地视频需要自己在sd卡目录下放一个视频文件,6.0以上是需要动态申请读写sd卡权限的,我代码里边没有加入,我在手机设置里自己手动开启的。 看下动态效果图: 先看下布局layout,IjkVideoView的高度必须要是>0否则不会创建view就不会创建MediaPalyer对象了。我建议不居中的IjkVideoView高度和宽度填充处理,之后IjkVideoView再根据视频的宽高按比例设置达到自适应的效果。如果想在video上实现滑动控制音量和亮度,我建议再加一层布局就可以自定义它实现手势滑动功能; <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android

Android 音视频深入 十九 使用ijkplayer做个视频播放器(更新:增加了小框,2018-3-12)

喜欢而已 提交于 2019-12-02 14:43:56
项目地址 https://github.com/979451341/Myijkplayer 前段时候我觉得FFmpeg做个视频播放器好难,虽然播放上没问题,但暂停还有通过拖动进度条来设置播放进度,这些都即便做得到,可以那个延缓。。。。。 现在学习一下目前移动端最知名的视频播放器的框架ijkplayer,这个框架他是基于FFmpeg、SDL、还有安卓原生API MediaCodec之类的。他是没有播放界面的,这个需要我们去做,所以这个里我就做个基于ijkplayer的视频播放器,随便浅显的说一下ijkplayer的源码,关于ijkplayer的源码以后会专门出一篇博客说一下。 1.首先了解一下ijkplayer咋用 我这里引入ijkplayer是通过添加依赖 implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8' implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8' implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8' implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8' implementation 'tv.danmaku

Changing Android SeekBar to draw secondary progress on top of primary progress?

 ̄綄美尐妖づ 提交于 2019-12-02 13:28:36
问题 I would like to change the behavior of an android seekbar so that the secondary android seekbar is actually drawn on top of the primary android seekbar. From the ProgressBar documentation listed here: http://developer.android.com/reference/android/widget/ProgressBar.html#attr_android:secondaryProgress This progress is drawn between the primary progress and the background. Current look of secondary Progress bar: Desired look of secondary progress bar: Ideally I'd like to override a method in

Swift: Trying to control time in AVAudioPlayerNode using UISlider

点点圈 提交于 2019-12-02 09:04:46
问题 I'm using an AVAudioPlayerNode attached to an AVAudioEngine to play a sound. to get the current time of the player I'm doing this: extension AVAudioPlayerNode { var currentTime: TimeInterval { get { if let nodeTime: AVAudioTime = self.lastRenderTime, let playerTime: AVAudioTime = self.playerTime(forNodeTime: nodeTime) { return Double(playerTime.sampleTime) / playerTime.sampleRate } return 0 } } } I have a slider that indicates the current time of the audio. When the user changes the slider

Changing Android SeekBar to draw secondary progress on top of primary progress?

北城以北 提交于 2019-12-02 05:50:00
I would like to change the behavior of an android seekbar so that the secondary android seekbar is actually drawn on top of the primary android seekbar. From the ProgressBar documentation listed here: http://developer.android.com/reference/android/widget/ProgressBar.html#attr_android:secondaryProgress This progress is drawn between the primary progress and the background. Current look of secondary Progress bar: Desired look of secondary progress bar: Ideally I'd like to override a method in ProgressBar.java in Android to change the order of drawing so that the secondary progress bar is drawn

How to get current color from Linear Gradient?

谁说胖子不能爱 提交于 2019-12-02 00:54:44
I have an Seek Bar whose values ranges from 1 to 10. The THUMB stops at 1,2,3,4,5 ... 10. The background color if SeekBar is Linear Gradient [Colors Start from RED, then YELLOW and lastly GREEN]. How to get the current color where thumb is positioned? Bartek Lipinski pskink's suggestion is right. You can use an ArgbEvaluator to achieve this goal. Let's assume this is your SeekBar : C1 C2 C3 +-------|-------|-------|-------|---+---|-------|-------|-------|-------+ 1 2 3 4 5 6 7 8 9 10 You've got 10 Thumb positions (numbers from 1 - 10 ), 3 colors ( + sign indicates the position of the color,

Changing default seekbar color

五迷三道 提交于 2019-12-01 19:03:11
If anybody knows what i'm doing wrong please let me know. I created an android app and I am trying to change the default color of the seekbar from yellow to any other color. I created an xml file located in all 3 drawables and ran the project but the color of the seekbar still isnt changing color. Below is the code me and a fellow mate from irc have been working on. <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="5dip" /> <gradient android:startColor="