Skip to content

Commit

Permalink
setspeed接口修改为支持播放中设置
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Mar 20, 2017
1 parent 9036b6e commit 7380dc9
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.shuyu.gsyvideoplayer.SmallVideoTouch;
import com.shuyu.gsyvideoplayer.listener.GSYMediaPlayerListener;
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
import com.shuyu.gsyvideoplayer.model.GSYModel;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import com.shuyu.gsyvideoplayer.utils.Debuger;
import com.shuyu.gsyvideoplayer.utils.OrientationUtils;
Expand All @@ -33,6 +34,8 @@
import java.util.HashMap;
import java.util.Map;

import tv.danmaku.ijk.media.player.IjkMediaPlayer;

import static com.shuyu.gsyvideoplayer.utils.CommonUtil.getActionBarHeight;
import static com.shuyu.gsyvideoplayer.utils.CommonUtil.getStatusBarHeight;
import static com.shuyu.gsyvideoplayer.utils.CommonUtil.hideNavKey;
Expand Down Expand Up @@ -699,10 +702,16 @@ public float getSpeed() {
}

/**
* 播放速度,只支持6.0以上
* 播放速度
*/
public void setSpeed(float speed) {
this.mSpeed = speed;
if (GSYVideoManager.instance().getMediaPlayer() != null
&& GSYVideoManager.instance().getMediaPlayer() instanceof IjkMediaPlayer) {
if (speed != 1 && speed > 0) {
((IjkMediaPlayer) GSYVideoManager.instance().getMediaPlayer()).setSpeed(speed);
}
}
}

public boolean isHideKey() {
Expand Down

0 comments on commit 7380dc9

Please sign in to comment.