Add option to enable/disable video overlay
This commit is contained in:
parent
ef6f9b97b0
commit
7fef2e7225
5 changed files with 72 additions and 32 deletions
|
|
@ -1,7 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:frosty/core/settings/settings_store.dart';
|
||||
import 'package:frosty/screens/channel/video/video_overlay.dart';
|
||||
import 'package:frosty/screens/channel/video/video_store.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class Video extends StatelessWidget {
|
||||
|
|
@ -20,26 +23,39 @@ class Video extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
WebView(
|
||||
initialUrl: 'https://player.twitch.tv/?channel=$userLogin&controls=false&muted=false&parent=frosty',
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
allowsInlineMediaPlayback: true,
|
||||
initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow,
|
||||
onWebViewCreated: (controller) {
|
||||
videoStore.controller = controller;
|
||||
},
|
||||
onPageFinished: (string) {
|
||||
videoStore.initVideo();
|
||||
},
|
||||
),
|
||||
VideoOverlay(
|
||||
title: title,
|
||||
userName: userName,
|
||||
videoStore: videoStore,
|
||||
),
|
||||
],
|
||||
return Observer(
|
||||
builder: (context) {
|
||||
if (context.read<SettingsStore>().overlayEnabled) {
|
||||
return Stack(
|
||||
children: [
|
||||
WebView(
|
||||
initialUrl: 'https://player.twitch.tv/?channel=$userLogin&controls=false&muted=false&parent=frosty',
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
allowsInlineMediaPlayback: true,
|
||||
initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow,
|
||||
onWebViewCreated: (controller) {
|
||||
videoStore.controller = controller;
|
||||
},
|
||||
onPageFinished: (string) {
|
||||
videoStore.initVideo();
|
||||
},
|
||||
),
|
||||
VideoOverlay(
|
||||
title: title,
|
||||
userName: userName,
|
||||
videoStore: videoStore,
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return WebView(
|
||||
initialUrl: 'https://player.twitch.tv/?channel=$userLogin&muted=false&parent=frosty',
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
allowsInlineMediaPlayback: true,
|
||||
initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue