Giter Club home page Giter Club logo

Comments (18)

maiwenchang avatar maiwenchang commented on June 18, 2024

请把你的代码发出来看一下

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

maiwenchang avatar maiwenchang commented on June 18, 2024

没看到您说的红色代码,您可以fork这个项目,修改代码然后发起一个PR,如果合理的话,会合并进这个项目。

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

OrientationChangeListener类

@OverRide
public void onOrientationPortrait(VideoView videoView) {
//竖屏
VideoView parentVideoView = videoView.getParentVideoView();
if (parentVideoView != null) {
parentVideoView.setControlPanel(videoView.getControlPanel());
}
videoView.exitFullscreen();
}

把 videoView.exitFullscreen();放进上面判断,可以解决黑屏,当时下面的进度条和暂停按钮被隐藏了,您有时间可以看一哈,

from artplayer.

maiwenchang avatar maiwenchang commented on June 18, 2024

OrientationChangeListener类

@OverRide
public void onOrientationPortrait(VideoView videoView) {
//竖屏
VideoView parentVideoView = videoView.getParentVideoView();
if (parentVideoView != null) {
parentVideoView.setControlPanel(videoView.getControlPanel());
}
videoView.exitFullscreen();
}

把 videoView.exitFullscreen();放进上面判断,可以解决黑屏,当时下面的进度条和暂停按钮被隐藏了,您有时间可以看一哈,

应该不是这么改的,我回去看一下,这种情况不应该调用这个方法。btw,这个方法本身应该没问题。

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

可以获取视频停止播放时候的进度吗,然后下次播放同一个视频可以续播?

from artplayer.

maiwenchang avatar maiwenchang commented on June 18, 2024

可以获取视频停止播放时候的进度吗,然后下次播放同一个视频可以续播?

可以,你可以在activity的onDestory里,通过MediaPlayerManager.getMediaPlayer().getCurrentPosition()先获取到当前播放的进度,保存起来,再去停止视频,下次就可以通过seekTo()方法续播了。

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

protected void onDestroy() {
super.onDestroy();
long currentPosition = MediaPlayerManager.instance().getMediaPlayer().getCurrentPosition();
SharedPreferenceUtil.putLong("time",currentPosition);
MediaPlayerManager.instance().releasePlayerAndView(this);
}

MediaPlayerManager.instance().releasePlayerAndView(this);
MediaPlayerManager.instance().setMediaPlayer(new IjkPlayer());

    controlPanel = new ControlPanel(this);
    videoView.setControlPanel(controlPanel);
    //optional: set title
    TextView tvTitle = controlPanel.findViewById(R.id.tvTitle);
    tvTitle.setText("西虹市首富 百变首富预告");
    //required: set url
    videoView.setUp("http://vfx.mtime.cn/Video/2018/07/06/mp4/180706094003288023.mp4");

// videoView.start();
//optional: set cover
Glide.with(this)
.load("http://img5.mtime.cn/mg/2018/07/06/093947.51483272.jpg")
.into((ImageView) controlPanel.findViewById(R.id.video_cover));
long time = SharedPreferenceUtil.getLong("time", 0);
if (time!=0){
MediaPlayerManager.instance().getMediaPlayer().seekTo(time);
videoView.start();
}

time值也获取到了,但是它还是从0开始播放-0-

from artplayer.

maiwenchang avatar maiwenchang commented on June 18, 2024

protected void onDestroy() {
super.onDestroy();
long currentPosition = MediaPlayerManager.instance().getMediaPlayer().getCurrentPosition();
SharedPreferenceUtil.putLong("time",currentPosition);
MediaPlayerManager.instance().releasePlayerAndView(this);
}

MediaPlayerManager.instance().releasePlayerAndView(this);
MediaPlayerManager.instance().setMediaPlayer(new IjkPlayer());

    controlPanel = new ControlPanel(this);
    videoView.setControlPanel(controlPanel);
    //optional: set title
    TextView tvTitle = controlPanel.findViewById(R.id.tvTitle);
    tvTitle.setText("西虹市首富 百变首富预告");
    //required: set url
    videoView.setUp("http://vfx.mtime.cn/Video/2018/07/06/mp4/180706094003288023.mp4");

// videoView.start();
//optional: set cover
Glide.with(this)
.load("http://img5.mtime.cn/mg/2018/07/06/093947.51483272.jpg")
.into((ImageView) controlPanel.findViewById(R.id.video_cover));
long time = SharedPreferenceUtil.getLong("time", 0);
if (time!=0){
MediaPlayerManager.instance().getMediaPlayer().seekTo(time);
videoView.start();
}

time值也获取到了,但是它还是从0开始播放-0-

我猜应该要先start(),再seekTo();

from artplayer.

shuhao1022 avatar shuhao1022 commented on June 18, 2024

按你说的做了,用的MediaPlayerManager.instance().seekTo(time),也进去
public void seekTo(long time) {
mediaPlayer.seekTo(time);
}
了,但是还是从头开始放的 ,不知道是不是start的问题

from artplayer.

maiwenchang avatar maiwenchang commented on June 18, 2024

已修复

from artplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.