seel-channel / video_viewer

FLUTTER PACKAGE: Multiplatform minimalist video viewer with spectacular user experience.
https://pub.dev/packages/video_viewer
MIT License
56 stars 57 forks source link

play an pause widget is showing all the time #35

Closed Joseph-Nathan closed 3 years ago

Joseph-Nathan commented 3 years ago

how can auto hidden this widget with over flow , i want use the player to live stream with chat , is possible to provide overflow widget in fullscreen , to used to appear massages .

seel-channel commented 3 years ago

Can you send a screenshot of the buggy widget?

Do you want to show a chat widget like Twitch's Chat

Screenshot_2021-07-20-00-51-05-417_tv.twitch.android.app.jpg

Joseph-Nathan commented 3 years ago

Can you send a screenshot of the buggy widget? it is good with normal video but with stream hls play an pause widget does not hidden .

No Button pressed

overFlow pressed

Like FaceBook i need top level widget and i will continue.

seel-channel commented 3 years ago

OK. I will fix the button bug and add the chat feature

seel-channel commented 3 years ago

Done. Check the 1.2.5. More details at example

Principal feature: enableChat: true, enableShowReplayIconAtVideoEnd: false and chatStyle: VideoViewerChatStyle(chat: SerieChat()),

class SerieVideoViewer extends StatefulWidget {
  const SerieVideoViewer(this.serie, {Key? key}) : super(key: key);

  final Serie serie;

  @override
  _SerieVideoViewerState createState() => _SerieVideoViewerState();
}

class _SerieVideoViewerState extends State<SerieVideoViewer> {

  @override
  Widget build(BuildContext context) {
    return VideoViewer(
      source: VideoSource.fromNetworkVideoSources(widget.serie.source.first),
      enableChat: true,
      enableShowReplayIconAtVideoEnd: false,
      style: CustomVideoViewerStyle(movie: widget.serie, context: context)
          .copyWith(
        chatStyle: const VideoViewerChatStyle(chat: SerieChat()),
      ),
    );
  }
}

class SerieChat extends StatefulWidget {
  const SerieChat({Key? key}) : super(key: key);

  @override
  _SerieChatState createState() => _SerieChatState();
}

class _SerieChatState extends State<SerieChat> {
  final ScrollController _controller = ScrollController();
  final List<String> _texts = [];
  late Timer timer;

  @override
  void initState() {
    timer = Misc.periodic(500, () {
      if (mounted) {
        _texts.add("HELLO");
        _controller.jumpTo(_controller.position.maxScrollExtent);
        setState(() {});
      }
    });
    super.initState();
  }

  @override
  void dispose() {
    timer.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: context.media.width / 3,
      color: Colors.black.withOpacity(0.8),
      child: ListView.builder(
        controller: _controller,
        itemCount: _texts.length,
        itemBuilder: (_, int index) {
          return Text(
            "x$index ${_texts[index]}",
            style: context.textTheme.subtitle1,
          );
        },
      ),
    );
  }
}