m3u8格式 视频播放
implementation 'com.shuyu:GSYVideoPlayer:7.1.6'
implementation 'com.android.support:design:30.0.0'
// XML
< com. shuyu. gsyvideoplayer. video. StandardGSYVideoPlayer
android: id= "@+id/play"
android: layout_width= "match_parent"
android: layout_height= "match_parent"
/ >
// 这样就可以播放啦 记得加网络权限
play = ( StandardGSYVideoPlayer) findViewById ( R . id. play) ;
play. setUp ( "https://txmov2.a.yximgs.com/upic/2020/11/12/18/BMjAyMDExMTIxODA2NTBfMjUyMDg5MDg5XzM5MTA4MTEzMjYwXzFfMw==_b_B349b0c56632f063aeb72d151a3f5505c.mp4" , true , "" ) ;
play. startPlayLogic ( ) ;
协调者布局
< ? xml version= "1.0" encoding= "utf-8" ? >
< RelativeLayout xmlns: android= "http://schemas.android.com/apk/res/android"
xmlns: app= "http://schemas.android.com/apk/res-auto"
xmlns: tools= "http://schemas.android.com/tools"
android: layout_width= "match_parent"
android: layout_height= "match_parent"
android: orientation= "vertical"
tools: context= ".view.Main2Activity" >
< androidx. coordinatorlayout. widget. CoordinatorLayout
android: layout_width= "match_parent"
android: layout_height= "match_parent" >
< com. google. android. material. appbar. AppBarLayout
android: layout_width= "match_parent"
android: layout_height= "match_parent" >
< com. google. android. material. appbar. CollapsingToolbarLayout
android: layout_width= "match_parent"
android: layout_height= "match_parent"
android: minHeight= "300dp"
app: layout_scrollFlags= "scroll|exitUntilCollapsed" >
< com. shuyu. gsyvideoplayer. video. StandardGSYVideoPlayer
android: id= "@+id/play"
android: layout_width= "match_parent"
android: layout_height= "match_parent"
app: layout_collapseMode= "parallax" / >
< / com. google. android. material. appbar. CollapsingToolbarLayout>
< / com. google. android. material. appbar. AppBarLayout>
< androidx. core. widget. NestedScrollView
android: layout_width= "match_parent"
android: layout_height= "match_parent"
app: layout_behavior= "com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" >
< LinearLayout
android: layout_width= "match_parent"
android: layout_height= "match_parent"
android: orientation= "vertical" >
< TextView
android: layout_width= "match_parent"
android: layout_height= "1000dp"
android: gravity= "center"
android: text= "爱了" / >
< / LinearLayout>
< / androidx. core. widget. NestedScrollView>
< / androidx. coordinatorlayout. widget. CoordinatorLayout>
< / RelativeLayout>
协调者布局不太明白可以看这位大神的.
链接: https://blog.csdn.net/u012124438/article/details/56701641