This repository has been archived on 2023-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
ha_client/lib/entity_widgets/common/camera_stream_view.dart

59 lines
1.3 KiB
Dart
Raw Normal View History

2019-01-29 21:59:05 +02:00
part of '../../main.dart';
class CameraStreamView extends StatefulWidget {
2019-01-29 21:59:05 +02:00
CameraStreamView({Key key}) : super(key: key);
2019-01-29 21:59:05 +02:00
@override
_CameraStreamViewState createState() => _CameraStreamViewState();
2019-01-29 21:59:05 +02:00
}
class _CameraStreamViewState extends State<CameraStreamView> {
2019-01-29 21:59:05 +02:00
@override
void initState() {
super.initState();
2019-01-31 01:04:13 +02:00
}
CameraEntity _entity;
bool started = false;
String streamUrl = "";
2019-01-29 21:59:05 +02:00
launchStream() {
HAUtils.launchURLInCustomTab(
context: context,
url: streamUrl,
enableDefaultShare: false,
showPageTitle: false
);
2019-02-20 13:57:25 +02:00
}
2019-01-29 21:59:05 +02:00
@override
Widget build(BuildContext context) {
if (!started) {
_entity = EntityModel
.of(context)
.entityWrapper
.entity;
started = true;
}
streamUrl = '${Connection().httpWebHost}/api/camera_proxy_stream/${_entity
.entityId}?token=${_entity.attributes['access_token']}';
return Column(
children: <Widget>[
Container(
padding: const EdgeInsets.all(20.0),
child: IconButton(
icon: Icon(MaterialDesignIcons.getIconDataFromIconName("mdi:monitor-screenshot"), color: Colors.amber),
iconSize: 50.0
2019-02-20 17:55:56 +02:00
)
)
],
);
2019-01-29 21:59:05 +02:00
}
@override
void dispose() {
super.dispose();
}
}