hsp_aliplayer

Last updated:

0 purchases

hsp_aliplayer Image
hsp_aliplayer Images
Add to Cart

Description:

hsp aliplayer

有问题联系我:[email protected]
用到的权限
安卓:
<!--网络权限-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!--点播播放器悬浮窗权限-->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<!--存储-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- 屏幕权限 -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
copied to clipboard
目前支持的视频格式有播放mp4,m3u8和阿里云直播;
功能:支持全屏、清晰度、播放速率,选集功能,滑动屏幕更改亮度音量
使用方法:
1、引入 import 'package:hsp_aliplayer/hsp_aliplayer.dart';
2、要使用OrientationBuilder这个widget监听屏幕方向并传入HspAliPlayer
HspAliPlayer(
//具体参照阿里云播放器文档,一般不用改变
playMode: ModeType.URL,
//视频链接
dataSourceMap:{DataSourceRelated.URL_KEY:'https://b.mhqiyi.com/20201120/bV8stIAo/index.m3u8'},
//OrientationBuilder的参数
orientation: _orientation,
),
3、建议播放器以外的内容用屏幕方向判断一下,横屏时候隐藏

4、完整代码



import 'package:flutter/material.dart';
import 'package:flutterapp/util/index.dart';
import 'package:hsp_aliplayer/hsp_aliplayer.dart';

class VideoDetailPage extends StatefulWidget {
@override
_VideoDetailPageState createState() => _VideoDetailPageState();
}

class _VideoDetailPageState extends State<VideoDetailPage> {
final videoList=[{'url':'https://b.mhqiyi.com/20201105/gDbyygPG/index.m3u8','id':'0'},
{'url':'https://b.mhqiyi.com/20201111/GfT21Exh/index.m3u8','id':'1'},
{'url':'https://b.mhqiyi.com/20201105/gDbyygPG/index.m3u8','id':'2'},
{'url':'https://b.mhqiyi.com/20201111/GfT21Exh/index.m3u8','id':'3'},];
@override
Widget build(BuildContext context) {
Orientation _orientation = MediaQuery.of(context).orientation;//获取屏幕方向

return OrientationBuilder(
builder: (BuildContext context,Orientation orientation){
return Scaffold(
body: Container(
color: HspColor.themeColor,
child: Column(
children: [
//小窗视频
HspAliPlayer(
playMode: ModeType.URL,
dataSourceMap:videoList,
playType: HspPlayType.Demand,//点播或者直播
// dataSourceMap:'http://live.mtdevelop.cn/jiaoyu/2021.flv?auth_key=1613795919-0-0-21428155d89c0e0ef3cf4605e0741af2',
orientation: _orientation,
isAutoPaly: false,
thumbnail: 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=4077016453,2135656356&fm=11&gp=0.jpg',
xuanChuanImg: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2219649508,3599350849&fm=11&gp=0.jpg',
),
// SmallVideoPage(),
Offstage(
offstage: _orientation==Orientation.landscape,
child: Container(
padding: EdgeInsets.all(HspSize.set(10)),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text("送你一朵小红花",style: TextStyle(color: HspColor.fontColor,fontWeight: FontWeight.w600,fontSize: HspSize.set(18)),),
),
Container(
child: Text("简介》",style: TextStyle(color: HspColor.fontColor),),
)
],
),
//演员
Container(
margin: EdgeInsets.only(top: HspSize.set(5),bottom: HspSize.set(5)),
alignment: Alignment.centerLeft,
child: Text("演员韩延",style: TextStyle(color: HspColor.fontLightColor),),
),
//简介
Container(
child: Text(
"简介:一个声称能“看见未来”的患癌男孩韦一航(易烊千玺饰),遇见了一个相信“平行世界”的患癌女孩马小远(刘浩存饰),在深夜的露台上,两人遥望夜空,展开了对各自所向往的美好世界的描述。 影片围绕两个抗癌家庭的两组生活轨迹展开,讲述了一个温情的现实故事,思考和直面了每一个普通人都会面临的终极问题——想象死亡随时可能到来,我们唯一要做的就是爱和珍惜"
,style: TextStyle(color: HspColor.fontLightColor)
,maxLines: 4,overflow: TextOverflow.ellipsis,),
),
//选集
Container(
child: Column(
children: [
Container(
margin: EdgeInsets.only(top: HspSize.set(5),bottom: HspSize.set(5)),
alignment: Alignment.centerLeft,
child: Text("选集",style: TextStyle(color: HspColor.fontColor,fontWeight: FontWeight.w600,fontSize: HspSize.set(18)),),
),
//集数
Container(
child: Wrap(
children: [
worksPanel()
],
),
)
],
),
)
],
),
),
)
//视频信息

],
),
),
);
},
);
}
}

//单集weigets

class worksPanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: HspSize.set(60),
height: HspSize.set(60),

);
}
}
copied to clipboard
参数说明:
playMode:默认ModeType.URL
playType: HspPlayType.Demand,(设置当前是点播还是直播)
orientation:屏幕方向(参考代码如上)
isAutoPaly:是否自动播放
thumbnail:海报图
xuanChuanImg:暂停或加载时候的宣传图
dataSourceMaps:视频链接(直播时候传字符串,点播时候传数组,格式如上)

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.