Skip to content

Commit

Permalink
Landscape phone full screen, also adding bluetooth
Browse files Browse the repository at this point in the history
  • Loading branch information
clone1018 committed Feb 25, 2022
1 parent 5774f91 commit 084be98
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 47 deletions.
8 changes: 6 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tv.glimesh.app">

<uses-permission android:name="android.permission.INTERNET"/>

<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
<intent>
Expand Down Expand Up @@ -61,10 +59,16 @@
android:name="flutterEmbedding"
android:value="2" />
</application>

<!-- Basic support for WebRTC -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

<!-- Support for Bluetooth headset listening? -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

<!-- <activity android:name="com.example.glimesh_app.flutter_web_auth.CallbackActivity" >
<intent-filter android:label="flutter_web_auth">
<action android:name="android.intent.action.VIEW" />
Expand Down
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 23;
DEVELOPMENT_TEAM = 3TCN256Z4Z;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down Expand Up @@ -488,7 +488,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 23;
DEVELOPMENT_TEAM = 3TCN256Z4Z;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
Expand All @@ -514,7 +514,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 23;
DEVELOPMENT_TEAM = 3TCN256Z4Z;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>21</string>
<string>23</string>
<key>FlutterDeepLinkingEnabled</key>
<true/>
<key>LSRequiresIPhoneOS</key>
Expand Down
1 change: 0 additions & 1 deletion lib/screens/AppScreen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:glimesh_app/components/Loading.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:glimesh_app/screens/ProfileScreen.dart';
import 'package:glimesh_app/screens/CategoryListScreen.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/screens/CategoryListScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:glimesh_app/models.dart';
import 'package:glimesh_app/blocs/repos/channel_list_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:glimesh_app/repository.dart';
import 'package:graphql_flutter/graphql_flutter.dart';

class CategoryListScreen extends StatelessWidget {
@override
Expand Down
75 changes: 40 additions & 35 deletions lib/screens/ChannelScreen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:glimesh_app/auth.dart';
import 'package:glimesh_app/blocs/repos/channel_bloc.dart';
import 'package:glimesh_app/components/Chat.dart';
import 'package:glimesh_app/components/FTLPlayer.dart';
Expand All @@ -15,8 +14,6 @@ class ChannelScreen extends StatelessWidget {

@override
Widget build(BuildContext context) {
final authState = AuthState.of(context);

return BlocBuilder<ChannelBloc, ChannelState>(
builder: (BuildContext context, ChannelState state) {
if (state is ChannelLoading) {
Expand All @@ -29,45 +26,28 @@ class ChannelScreen extends StatelessWidget {

if (state is ChannelReady) {
final JanusEdgeRoute edgeRoute = state.edgeRoute;
ChannelBloc bloc = BlocProvider.of<ChannelBloc>(context);

print("ChannelReady");

Widget chatWidget = Chat(channel: channel);

Widget videoPlayer = Stack(
children: [
AspectRatio(
aspectRatio: 16 / 9,
child: FTLPlayer(channel: channel, edgeUrl: edgeRoute.url),
),
InkWell(
child: Padding(
padding: EdgeInsets.all(5),
child: Icon(
Icons.chevron_left,
color: Colors.white70,
),
),
onTap: () => Navigator.pop(context),
)
],
);
Widget metadata = Container(
child: StreamTitle(
channel: channel,
allowMetadata: true,
),
);

return Scaffold(
body: SafeArea(
child: OrientationBuilder(
builder: (context, orientation) {
if (orientation == Orientation.portrait) {
return _buildStacked(edgeRoute.url, videoPlayer, chatWidget);
return _buildStacked(
_videoPlayer(context, edgeRoute.url),
chatWidget,
);
} else {
return _buildSidebar(edgeRoute.url, videoPlayer, chatWidget);
double width = MediaQuery.of(context).size.width;
// 1000 is arbitrary...
if (width < 1000) {
return _videoPlayer(context, edgeRoute.url,
forceAspectRatio: false);
} else {
return _buildSidebar(
_videoPlayer(context, edgeRoute.url), chatWidget);
}
}
},
),
Expand All @@ -79,8 +59,34 @@ class ChannelScreen extends StatelessWidget {
});
}

Widget _videoPlayer(context, url, {forceAspectRatio = true}) {
Widget ftlPlayer = FTLPlayer(channel: channel, edgeUrl: url);
Widget videoChild = forceAspectRatio
? AspectRatio(
aspectRatio: 16 / 9,
child: ftlPlayer,
)
: Center(child: ftlPlayer);
final Widget subtree = Stack(
children: [
videoChild,
InkWell(
child: Padding(
padding: EdgeInsets.all(5),
child: Icon(
Icons.chevron_left,
color: Colors.white70,
),
),
onTap: () => Navigator.pop(context),
)
],
);

return subtree;
}

Widget _buildStacked(
String edgeUrl,
Widget videoPlayer,
Widget chatWidget,
) {
Expand All @@ -101,7 +107,6 @@ class ChannelScreen extends StatelessWidget {
}

Widget _buildSidebar(
String edgeUrl,
Widget videoPlayer,
Widget chatWidget,
) {
Expand Down
1 change: 0 additions & 1 deletion lib/screens/FollowingScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:glimesh_app/blocs/repos/channel_list_bloc.dart';
import 'package:glimesh_app/components/ChannelList.dart';
import 'package:glimesh_app/components/Loading.dart';
import 'package:glimesh_app/repository.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:glimesh_app/models.dart';

class FollowingScreen extends StatelessWidget {
Expand Down
1 change: 0 additions & 1 deletion lib/screens/LoginScreen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:glimesh_app/glimesh.dart';
import 'package:glimesh_app/auth.dart';
import 'package:gql_phoenix_link/gql_phoenix_link.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:package_info_plus/package_info_plus.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/screens/ProfileScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:glimesh_app/blocs/repos/user_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:glimesh_app/models.dart';
import 'package:glimesh_app/repository.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+21
version: 1.0.0+23

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 084be98

Please sign in to comment.