0

Hello developer i am using chewie plugin for playing live streaming video its is m3u8 video link when run it ios real device it give this exception "The getter '_duration' was called on null." on ios while its work fine on android device but ios real device. i dont know how solve issue on ios real device any expert developer is here is who can help solving this issue here is exception.

 flutter: Another exception was thrown: NoSuchMethodError: The getter '_duration' was called on null.

my code

 import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:video_player/video_player.dart';

class ChewieListItem extends StatefulWidget {
  // This will contain the URL/asset path which we want to play
  final VideoPlayerController videoPlayerController;
  final bool looping;

  ChewieListItem({
    @required this.videoPlayerController,
    this.looping,
    Key key,
  }) : super(key: key);

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

class _ChewieListItemState extends State<ChewieListItem> {
  ChewieController _chewieController;

  @override
  void initState() {
    super.initState();
    // Wrapper on top of the videoPlayerController
    _chewieController = ChewieController(
      videoPlayerController: widget.videoPlayerController,
      aspectRatio: 16 / 9,
      // Prepare the video to be played and display the first frame
      autoInitialize: true,
      looping: widget.looping,
 deviceOrientationsAfterFullScreen:[DeviceOrientation.portraitUp] ,
      // Errors can occur for example when trying to play a video
      // from a non-existent URL
      errorBuilder: (context, errorMessage) {
        return Center(
          child: Text(
            errorMessage,
            style: TextStyle(color: Colors.white),
          ),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: Chewie(
        controller: _chewieController,
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
    ]);
    // IMPORTANT to dispose of all the used resources
    widget.videoPlayerController.dispose();
    _chewieController.dispose();
    _chewieController.pause();

  }
}

streaming

 child: Column(

              children: <Widget>[

                Expanded(
                  child: ChewieListItem(
                    videoPlayerController: VideoPlayerController.network(
                      'https://streamer12.vdn.dstreamone.net/livinghope/livinghope/playlist.m3u8',),
                  ),
                )
Aneel Illyas
  • 185
  • 1
  • 2
  • 12
  • have you tried it with another URL? if yes are the results the same? – Henok Jul 25 '20 at 07:52
  • no but there no issue in url because it working fine on android device but on ios it not working real device may be it work for .mp4 url but it live tv link i need fixed in m3u8 link – Aneel Illyas Jul 25 '20 at 07:57

0 Answers0