flutter - 如果链接不起作用,则颤动媒体 url 重定向到另一个 url
问题描述
目前我正在开发一个直播电视应用程序。每个电视频道将包含多个用于备份的直播网址。如果一个 url 关闭,则自动重定向到另一个实时 url。
在频道详情页面中是否可以将其他电视频道显示为相关频道?
class _ChannelDetailsState extends State<ChannelDetails> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(widget.channels.ChannelUrl_1)
..initialize().then((_) {
setState(() {
_controller.play();
});
});
}
Container(
child: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(
_controller,
))
: Container(
color: Colors.black,
child: Container(
height: 200,
child: Center(child: CircularProgressIndicator()))),
),
这是 Api json 格式
{
"success": true,
"data": [
{
"id": 1,
"Channel_Name": "Channel 1",
"Channel_Image": "http://liveurl/images/profile.png",
"Channel_Url_1": "http://livetvchannelurl1.m3u8",
"Channel_Url_2": "http://livetvchannelurl2.m3u8",
"Channel_Url_3": "http://livetvchannelurl3.m3u8",
"Channel_Description": "Channel Description goes here",
"created_at": "2021-10-19T18:49:08.000000Z",
"updated_at": "2021-10-20T08:00:53.000000Z"
},
{
"id": 2,
"Channel_Name": "Channel 2",
"Channel_Image": "http://liveurl/images/profile.png",
"Channel_Url_1": "http://livetvchannelurl1.m3u8",
"Channel_Url_2": "http://livetvchannelurl2.m3u8",
"Channel_Url_3": "http://livetvchannelurl3.m3u8",
"Channel_Description": "Description goes here",
"created_at": "2021-10-19T20:21:56.000000Z",
"updated_at": "2021-10-20T08:01:08.000000Z"
}
],
"message": "Channels retrieved successfully"
}
谁能帮我吗。谢谢
解决方案
推荐阅读
- javascript - 如何停止节点js中代码的执行而不是返回
- c# - 从脚本中删除之前在 TextMeshPro 中输入的文本
- android - XML 文件从 Android 8.1.0 复制到 windows 或 mac
- sql - 如何将所有对象(表、视图、过程、函数等)的所有特权授予 oracle 中的角色
- ionic-framework - 如何在警报控制器顶部添加图像?
- javascript - Python中crypto.getRandomValues和Uint32Array的等价物
- python - 使用 SEM(ns-3 模拟执行管理器)运行 python 代码时 ns3-lte 构建失败
- django - 有没有办法使用 SerializerMethodField 并仍然写入它?
- amazon-web-services - 亚马逊 s3 的 AWS EMRFS S3 护林员插件错误
- firebase - 从后台返回后未建立 Firebase 连接