mengzhidaren / Vlc-sdk-lib

vlc-android The latest compilation video playback libraries 最新视频库支持录屏 欢迎star
491 stars 121 forks source link

vlcVideoView.getCurrentPosition(),在开始播放视频之后调用,获取不到当前播放时间 #137

Closed mylikethranduil closed 4 years ago

mylikethranduil commented 6 years ago

播放视频的时候,getCurrentPosition获取不到视频当前播放时间,说是视频编码格式的问题,需要在视频解码的时候去读取时间信息,请问有开放解码视频的回调吗?

mengzhidaren commented 6 years ago

MediaPlayer.Event.TimeChanged 和 MediaPlayer.Event.PositionChanged 修改VlcPlayer可以对这两个回调监听

mylikethranduil commented 6 years ago

谢大神指点🙏🙏🙏

mingxin-yang commented 6 years ago

MediaPlayer.Event.TimeChanged 和 MediaPlayer.Event.PositionChanged 修改VlcPlayer可以对这两个回调监听

@mengzhidaren image

这样写为什么监听不到啊,log都打不出来,能讲的详细一些吗

mingxin-yang commented 6 years ago

@mylikethranduil 求解答,怎么解决的

mengzhidaren commented 6 years ago

MediaPlayer.Event.TimeChanged 试过没 如果不是直播流的话应该能监听到的。先用官方apk试下

mingxin-yang commented 6 years ago

@mengzhidaren 我用的是直播流的形式播放的

ArrayList<String> libOptions = VLCOptions.getLibOptions(this);
LibVLC libVLC = new LibVLC(this, libOptions);
media = new Media(libVLC, Uri.parse(mUrl));
media.setHWDecoderEnabled(false, false);
media.addOption(":network-caching=100");
mediaPlayer = new MediaPlayer(media);
mSurfaceView.setMedia(mediaPlayer);

应该是这个问题导致的