-
-
Save sbis04/de7c04348d29f4ee3801abdade9252d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PreviewPage extends StatefulWidget { | |
final Data assetData; | |
const PreviewPage({@required this.assetData}); | |
@override | |
_PreviewPageState createState() => _PreviewPageState(); | |
} | |
class _PreviewPageState extends State<PreviewPage> { | |
VideoPlayerController _controller; | |
Data assetData; | |
String dateTimeString; | |
@override | |
void initState() { | |
super.initState(); | |
assetData = widget.assetData; | |
String playbackId = assetData.playbackIds[0].id; | |
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | |
int.parse(assetData.createdAt) * 1000); | |
DateFormat formatter = DateFormat.yMd().add_jm(); | |
dateTimeString = formatter.format(dateTime); | |
_controller = VideoPlayerController.network( | |
'$muxStreamBaseUrl/$playbackId.$videoExtension') | |
..initialize().then((_) { | |
setState(() {}); | |
}); | |
_controller.play(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
elevation: 0, | |
brightness: Brightness.dark, | |
title: Text('Video preview'), | |
backgroundColor: CustomColors.muxPink, | |
), | |
body: SingleChildScrollView( | |
physics: BouncingScrollPhysics(), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
// Add the widgets here | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment