plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[video_player_tizen] Videos are playing with software codec

Open huluwa-dev opened this issue 1 year ago • 37 comments

I tried to play an HLS video with video_player_tizen, but when the video quality automatically updated to 1080P, the playback started stuttering significantly. I assume the video was played using a software codec, as other video-playing apps work well (like YouTube), even with 4K videos.

Could you help me confirm whether this plugin uses a software decoder for video playback? Thanks.

This is the code snippet:


class VideoPlayerWidget extends ConsumerStatefulWidget {
  const VideoPlayerWidget({
    super.key,
  });

  @override
  ConsumerState createState() => _VideoPlayerWidgetState();
}

class _VideoPlayerWidgetState extends ConsumerState<VideoPlayerWidget> {
  late VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();
    _controller = VideoPlayerController.networkUrl(
        Uri.parse('https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8'))
      ..initialize().then((_) {
        // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
        setState(() {});
      });
  }

  bool get _videoReady => _controller.value.isInitialized == true;

  @override
  Widget build(BuildContext context) {
    return _buildVideoPlayer();
  }

  Widget _buildVideoPlayer() {
    return Container(
      width: double.infinity,
      height: double.infinity,
      color: context.theme.black,
      child: _videoReady
          ? VideoPlayer(_controller)
          : Center(
              child: CircularProgressIndicator(
                color: Colors.white,
              ),
            ),
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }
}

huluwa-dev avatar Oct 24 '24 03:10 huluwa-dev