hls_player 0.0.1 hls_player: ^0.0.1 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();
}
// Platform messages are asynchronous, so we initialize in an async method.
static Future<void> initPlatformState() async {
String url =
"http://200.23.206.107:18080/canales/nacionales/tvnHD2/playlist.m3u8";
// Platform messages may fail, so we use a try/catch PlatformException.
try {
await HlsPlayer.initialize(url: url);
} on PlatformException {}
}
Widget testWidget = new MediaQuery(
data: new MediaQueryData(),
child: new MaterialApp(
home: Scaffold(
body: RaisedButton(
child: Text(
'Search',
style: TextStyle(fontSize: 18.0),
),
onPressed: () {
initPlatformState();
},
)),
),
);
@override
Widget build(BuildContext context) {
return testWidget;
}
}