OpenMediacenterMobileFlutter/lib/videoscreen_web.dart

53 lines
1.1 KiB
Dart
Raw Normal View History

2022-04-15 16:15:44 +00:00
import 'dart:convert';
import 'package:flutter/material.dart';
import 'api/api.dart';
import 'api/token.dart';
import 'log/log.dart';
2022-04-15 16:15:44 +00:00
class VideoScreen extends StatefulWidget {
const VideoScreen({Key? key, required this.videoID}) : super(key: key);
final int videoID;
@override
State<VideoScreen> createState() => _VideoScreenState();
}
class _VideoScreenState extends State<VideoScreen> {
void loadData() async {
final data =
await API.query("video", "loadVideo", {'MovieId': widget.videoID});
2022-04-15 16:15:44 +00:00
final d = jsonDecode(data);
final url = d["MovieUrl"];
final token = await Token.getInstance().getToken();
if (token == null) return;
final baseurl = token.domain;
// todo not static middle path
final String path = baseurl + "/videos/vids/" + url;
Log.d(path);
2022-04-15 16:15:44 +00:00
}
@override
void initState() {
super.initState();
loadData();
// todo hide appbar after some seonds
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Second Route'),
),
body: const Center(child: Text("Todo to implement")),
2022-04-15 16:15:44 +00:00
);
}
}