when i try to play this video using this url "https://delivery517.akamai-video-content.com/hls2/01/01760/fgesr7u3hfzl_n/index-v1-a1.m3u8?t=TmRywG1Pi65jbfXWoVSj-k-gvBc8mG1onwqKjcn1gY8&s=1683131305&e=10800&f=8802758&srv=sto088&client=202.142.121.85" it throws this error but when i make a get request to this url using http using this header {"watchsb": 'sbstream'}
i get response like this
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:10.000,
https://delivery517.akamai-video-content.com/hls2/01/01760/fgesr7u3hfzl_n/seg-1-v1-a1.ts?t=LX4mGZX-kKnjzx0HxvP_pvBkRrshnHhl7VZ-9dVHUvQ&s=1683132127&e=10800&f=8802758&srv=sto088&client=202.142.121.85
#EXTINF:10.000,
https://delivery517.akamai-video-content.com/hls2/01/01760/fgesr7u3hfzl_n/seg-2-v1-a1.ts?t=LX4mGZX-kKnjzx0HxvP_pvBkRrshnHhl7VZ-9dVHUvQ&s=1683132127&e=10800&f=8802758&srv=sto088&client=202.142.121.85
#EXTINF:10.000,
https://delivery517.akamai-video-content.com/hls2/01/01760/fgesr7u3hfzl_n/seg-3-v1-a1.ts?t=LX4mGZX-kKnjzx0HxvP_pvBkRrshnHhl7VZ-9dVHUvQ&s=1683132127&e=10800&f=8802758&srv=sto088&client=202.142.121.85
#EXTINF:10.000
....
#EXT-X-ENDLIST
first i thought the problem was the headers but i am correctly sending the headers and the url to the video player
Here's The Code
class VideoApp extends StatefulWidget {
final VideoFile videoFile;
final List<VideoServerResponse> servers;
final String title;
const VideoApp(
{super.key,
required this.title,
required this.videoFile,
required this.servers});
@override
State<VideoApp> createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
widget.videoFile.data[0].fileUrl,
httpHeaders: widget.videoFile.headers)
..initialize().then((_) {
_controller.play();
setState(() {});
})
..setLooping(true);
}
Widget _buildPlayerWidget(BuildContext context) {
return (!_controller.value.isInitialized)
? const CircularProgressIndicator(
color: Colors.pinkAccent,
)
: OkVideoPlayer(
title: widget.title,
controller: _controller,
videoFile: widget.videoFile,
servers: widget.servers,
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
darkTheme: ThemeData.dark(useMaterial3: true),
home: Scaffold(
extendBodyBehindAppBar: true,
backgroundColor: Colors.black,
body: Center(child: _buildPlayerWidget(context))),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}