hls_player 1.0.2 hls_player: ^1.0.2 copied to clipboard
A new flutter plugin project.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:hls_player/hls_player.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// initPlatformState();
// initZappingPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
static Future<void> initPlatformState() async {
const uRL_VIDEO =
"http://200.23.206.107:18080/canales/miscelaneos/docubox/playlist.m3u8";
try {
await HlsPlayer.initializeVideo(url: uRL_VIDEO).then((onValue) {
print(onValue);
}).catchError((onError) {
print(onError);
});
} on PlatformException {}
}
static Future<void> initZappingPlatformState() async {
const uRL_VIDEO =
"http://200.23.206.107:18080/canales/miscelaneos/docubox/playlist.m3u8";
const uRL_VIDEO2 =
r"http://181.65.250.202/33h_57dd1055991fe503_$bcb7ce2ca3d7370639a9/canales/nacionales/exitosaonline.stream/playlist.m3u8";
const uRL_VIDEO3 =
r"https://181.65.250.202/33h_x86_64_$d28b8ab7c54479c4a5c4/canales/nacionales/latele/playlist.m3u8";
final canales = [uRL_VIDEO, uRL_VIDEO2, uRL_VIDEO3];
try {
await HlsPlayer.initializeZapping(canales: canales, playVideoAtIndex: 1)
.then((onValue) {
print(onValue);
}).catchError((onError) {
print(onError);
});
} on PlatformException {}
}
Widget testWidget = new MediaQuery(
data: new MediaQueryData(),
child: new MaterialApp(
home: Scaffold(
body: Column(
children: <Widget>[
RaisedButton(
child: Text(
'play video',
style: TextStyle(fontSize: 18.0),
),
onPressed: () {
initPlatformState();
},
),
RaisedButton(
child: Text(
'play videos zapping',
style: TextStyle(fontSize: 18.0),
),
onPressed: () {
initZappingPlatformState();
},
),
],
)),
),
);
@override
Widget build(BuildContext context) {
return testWidget;
}
}