Skip to content

Commit

Permalink
Fixed player flickr
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed Apr 17, 2024
1 parent d324703 commit 576ec6d
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
library;

///Dart imports
import 'dart:io';

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
Expand All @@ -25,8 +22,7 @@ class HLSViewerBottomNavigationBar extends StatelessWidget {
end: Alignment.bottomCenter,
colors: [Colors.black.withAlpha(0), Colors.black.withAlpha(64)])),
child: Padding(
padding: EdgeInsets.only(
bottom: Platform.isIOS ? 32.0 : 12, left: 12, right: 12),
padding: EdgeInsets.only(left: 12, right: 12),

///Here we render the chat component if the chat is opened
///We also render the leave button, hand raise button, chat button and the menu button
Expand Down
90 changes: 44 additions & 46 deletions packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ library;

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';

///Project imports
import 'package:hms_room_kit/src/common/utility_components.dart';
Expand All @@ -28,7 +26,7 @@ class HLSViewerHeader extends StatelessWidget {
HMSThemeColors.backgroundDim.withAlpha(0)
])),
child: Padding(
padding: EdgeInsets.only(left: 12, right: 12, top: 8),
padding: EdgeInsets.only(left: 12, right: 12),
child: Selector<HLSPlayerStore, bool>(
selector: (_, hlsPlayerStore) =>
hlsPlayerStore.areStreamControlsVisible,
Expand All @@ -55,50 +53,50 @@ class HLSViewerHeader extends StatelessWidget {

///This renders the [Caption Button] and [Settings Button] only if the controls are visible
///and the HLS has started
if (hasHLSStarted)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
///The caption button is only rendered when closed captions are supported
///and the HLS has started
Selector<HLSPlayerStore, Tuple2<bool, bool>>(
selector: (_, hlsPlayerStore) => Tuple2(
hlsPlayerStore.isCaptionEnabled,
hlsPlayerStore.areCaptionsSupported),
builder: (_, captionsData, __) {
return captionsData.item2
? InkWell(
onTap: () {
context
.read<HLSPlayerStore>()
.toggleCaptions();
},
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/caption_${captionsData.item1 ? "on" : "off"}.svg",
colorFilter: ColorFilter.mode(
HMSThemeColors
.onSurfaceHighEmphasis,
BlendMode.srcIn),
semanticsLabel:
"caption_toggle_button",
),
)
: const SizedBox();
}),
const SizedBox(
width: 16,
),
// if (hasHLSStarted)
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// ///The caption button is only rendered when closed captions are supported
// ///and the HLS has started
// Selector<HLSPlayerStore, Tuple2<bool, bool>>(
// selector: (_, hlsPlayerStore) => Tuple2(
// hlsPlayerStore.isCaptionEnabled,
// hlsPlayerStore.areCaptionsSupported),
// builder: (_, captionsData, __) {
// return captionsData.item2
// ? InkWell(
// onTap: () {
// context
// .read<HLSPlayerStore>()
// .toggleCaptions();
// },
// child: SvgPicture.asset(
// "packages/hms_room_kit/lib/src/assets/icons/caption_${captionsData.item1 ? "on" : "off"}.svg",
// colorFilter: ColorFilter.mode(
// HMSThemeColors
// .onSurfaceHighEmphasis,
// BlendMode.srcIn),
// semanticsLabel:
// "caption_toggle_button",
// ),
// )
// : const SizedBox();
// }),
// const SizedBox(
// width: 16,
// ),

///This renders the settings button
SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/settings.svg",
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis,
BlendMode.srcIn),
semanticsLabel: "caption_toggle_button",
)
],
)
// ///This renders the settings button
// SvgPicture.asset(
// "packages/hms_room_kit/lib/src/assets/icons/settings.svg",
// colorFilter: ColorFilter.mode(
// HMSThemeColors.onSurfaceHighEmphasis,
// BlendMode.srcIn),
// semanticsLabel: "caption_toggle_button",
// )
// ],
// )
],
)
: const SizedBox();
Expand Down
4 changes: 2 additions & 2 deletions packages/hms_room_kit/lib/src/hls_viewer/hls_viewer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ class _HLSViewerPageState extends State<HLSViewerPage> {
builder: (_, isFullScreen, __) {
double widgetHeight = height -
MediaQuery.of(context)
.padding
.viewPadding
.top -
MediaQuery.of(context)
.padding
.viewPadding
.bottom;
return Column(
mainAxisAlignment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
library;

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';

///Project imports
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hms_room_kit/src/layout_api/hms_room_layout.dart';
import 'package:hms_room_kit/src/meeting/meeting_store.dart';
import 'package:hms_room_kit/src/widgets/bottom_sheets/end_service_bottom_sheet.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/leave_session_tile.dart';
import 'package:provider/provider.dart';

class LeaveSessionBottomSheet extends StatefulWidget {
final MeetingStore meetingStore;
Expand All @@ -29,6 +35,8 @@ class _LeaveSessionBottomSheetState extends State<LeaveSessionBottomSheet> {
super.deactivate();
}

///Here we render bottom sheet with leave and end options
@override
Widget build(BuildContext context) {
return ((widget.meetingStore.localPeer?.role.permissions.endRoom ??
Expand Down Expand Up @@ -74,7 +82,8 @@ class _LeaveSessionBottomSheetState extends State<LeaveSessionBottomSheet> {
widget.meetingStore.leave(),
},
title: HMSTitleText(
text: "Leave Session",
text:
"Leave ${HMSRoomLayout.peerType == PeerRoleType.conferencing ? "Session" : "Stream"}",
textColor: HMSThemeColors.alertErrorDefault,
letterSpacing: 0.15,
fontSize: 20,
Expand All @@ -89,11 +98,12 @@ class _LeaveSessionBottomSheetState extends State<LeaveSessionBottomSheet> {
),
subTitle: HMSSubheadingText(
text:
"Others will continue after you leave. You can join\n the session again.",
"Others will continue after you leave. You can join the session again.",
maxLines: 2,
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
),
buttonText: "Leave Session",
buttonText:
"Leave ${HMSRoomLayout.peerType == PeerRoleType.conferencing ? "Session" : "Stream"}",
),
),
)
Expand Down Expand Up @@ -200,7 +210,8 @@ class _LeaveSessionBottomSheetState extends State<LeaveSessionBottomSheet> {
widget.meetingStore.leave(),
},
title: HMSTitleText(
text: "Leave Session",
text:
"Leave ${HMSRoomLayout.peerType == PeerRoleType.conferencing ? "Session" : "Stream"}",
textColor: HMSThemeColors.alertErrorDefault,
letterSpacing: 0.15,
fontSize: 20,
Expand All @@ -214,11 +225,12 @@ class _LeaveSessionBottomSheetState extends State<LeaveSessionBottomSheet> {
),
subTitle: HMSSubheadingText(
text:
"Others will continue after you leave. You can join\n the session again.",
"Others will continue after you leave. You can join the session again.",
maxLines: 2,
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
),
buttonText: "Leave Session",
buttonText:
"Leave ${HMSRoomLayout.peerType == PeerRoleType.conferencing ? "Session" : "Stream"}",
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class _ReceipientSelectorChipState extends State<ReceipientSelectorChip> {
}
},
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0, top: 16),
padding: const EdgeInsets.only(bottom: 8.0),
child: Row(
children: [
Padding(
Expand Down
40 changes: 30 additions & 10 deletions packages/hmssdk_flutter/lib/src/ui/meeting/hms_hls_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
import 'dart:io' show Platform;

// Flutter imports:
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show StandardMessageCodec;
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'
show AndroidViewController, PlatformViewsService, StandardMessageCodec;

///100ms HMSHLSPlayer
///
Expand Down Expand Up @@ -65,17 +69,33 @@ class _PlatformView extends StatelessWidget {
Widget build(BuildContext context) {
///AndroidView for android it uses surfaceRenderer provided internally by webrtc.
if (Platform.isAndroid) {
return AndroidView(
key: key,
return PlatformViewLink(
viewType: 'HMSHLSPlayer',
onPlatformViewCreated: onPlatformViewCreated,
creationParamsCodec: StandardMessageCodec(),
creationParams: {
'hls_url': hlsUrl,
'is_hls_stats_required': isHLSStatsRequired,
'show_player_controls': showPlayerControls
surfaceFactory: (context, controller) {
return AndroidViewSurface(
controller: controller as AndroidViewController,
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
);
},
onCreatePlatformView: (params) {
return PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: 'HMSHLSPlayer',
layoutDirection: TextDirection.ltr,
creationParams: {
'hls_url': hlsUrl,
'is_hls_stats_required': isHLSStatsRequired,
'show_player_controls': showPlayerControls
},
creationParamsCodec: const StandardMessageCodec(),
onFocus: () {
params.onFocusChanged(true);
},
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
gestureRecognizers: {},
);
} else if (Platform.isIOS) {
///UIKitView for ios it uses VideoView provided by 100ms ios_sdk internally.
Expand Down

0 comments on commit 576ec6d

Please sign in to comment.