Settings loading refactored. WIP #338
This commit is contained in:
@ -16,6 +16,7 @@ class _CameraStreamViewState extends State<CameraStreamView> {
|
||||
}
|
||||
|
||||
CameraEntity _entity;
|
||||
String _webHost;
|
||||
|
||||
http.Client client;
|
||||
http.StreamedResponse response;
|
||||
@ -28,7 +29,7 @@ class _CameraStreamViewState extends State<CameraStreamView> {
|
||||
void _connect() async {
|
||||
started = true;
|
||||
timeToStop = false;
|
||||
String streamUrl = '$homeAssistantWebHost/api/camera_proxy_stream/${_entity.entityId}?token=${_entity.attributes['access_token']}';
|
||||
String streamUrl = '$_webHost/api/camera_proxy_stream/${_entity.entityId}?token=${_entity.attributes['access_token']}';
|
||||
client = new http.Client(); // create a client to make api calls
|
||||
http.Request request = new http.Request("GET", Uri.parse(streamUrl)); // create get request
|
||||
Logger.d("[Sending] ==> $streamUrl");
|
||||
@ -130,6 +131,7 @@ class _CameraStreamViewState extends State<CameraStreamView> {
|
||||
.of(context)
|
||||
.entityWrapper
|
||||
.entity;
|
||||
_webHost = HomeAssistantModel.of(context).homeAssistant.httpAPIEndpoint;
|
||||
_connect();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class MediaPlayerWidget extends StatelessWidget {
|
||||
|
||||
Widget _buildImage(MediaPlayerEntity entity) {
|
||||
String state = entity.state;
|
||||
if (homeAssistantWebHost != null && entity.entityPicture != null && state != EntityState.off && state != EntityState.unavailable && state != EntityState.idle) {
|
||||
if (entity.entityPicture != null && state != EntityState.off && state != EntityState.unavailable && state != EntityState.idle) {
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
child: Row(
|
||||
|
Reference in New Issue
Block a user