ksvc / KSYMediaPlayer_Android

金山云Android播放SDK(KSYUN Live Streaming player SDK),支持RTMP HTTP-FLV HLS 协议(supporting RTMP HTTP-FLV HLS protocol),直播延时2-3秒(Living delay 2 or 3 seconds),supporting jitter control,software&hardware decode
http://v.ksyun.com/
Apache License 2.0
853 stars 246 forks source link

大小窗口播放,转换层级的时候,黑屏了,进度再走,但是没有画面 #188

Open apple2360541 opened 6 years ago

apple2360541 commented 6 years ago

<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/video_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:orientation="vertical"> <com.ksyun.media.player.KSYTextureView android:id="@+id/video_person" android:layout_width="match_parent" android:layout_height="match_parent"/> <com.yihuan.archeryplus.widget.DragLayout android:id="@+id/drag_layout" android:layout_width="@dimen/dp_120" android:layout_height="@dimen/dp_90" android:layout_marginTop="@dimen/dp_50" android:layout_marginLeft="@dimen/dp_150" android:orientation="vertical"> <com.ksyun.media.player.KSYTextureView android:id="@+id/video_target" android:layout_width="match_parent" android:layout_height="match_parent" /> </com.yihuan.archeryplus.widget.DragLayout> 我们的需求是在屏幕里面放一个大的视频,充满全屏,然后放一个小的窗口,可以拖动,小窗口始终在大窗口的上面,这样小窗口就挡住了大窗口的部分画面,为了可以看到下面,当点击小窗口的时候,讲两个视频从容器里面removeView(),然后相反添加到对方的容器里面,实现播放器的转换!但是remove后再addView(),视频就黑了,但是进度任然再走,其他的播放器没有这个现象播放的m3u8地址 http://archerycn-video.gz.bcebos.com/play.archeryplus.cn/tianjin_shangqun/18_02B/59ca4b4e9fd101175159ad58_ownerBackCamera.m3u8

http://archerycn-video.gz.bcebos.com/play.archeryplus.cn/tianjin_shangqun/18_02A/59ca4b4e9fd101175159ad58_ownerFrontCamera.m3u8

dengchu817 commented 6 years ago

@apple2360541 看看前后台切换https://github.com/ksvc/KSYMediaPlayer_Android/wiki/KSYTextureView

FirmianaRain commented 6 years ago
  1. 建议别用硬解,removeView和addView 会导致 SurfaceTexture的销毁重新创建,这样会重新创建硬解码器,播放会黑一会儿
  2. 在addView之后调用setComeBackFromShare(true)