init method

Future<void> init(
  1. String url,
  2. double width,
  3. double height,
  4. bool isRepeat,
)

Implementation

Future<void> init(String url, double width, double height, bool isRepeat) async {
  if (playInfoStream != null) {
    playInfoStream?.cancel();
    playInfoStream = null;
  }

  playInfoStream = Stream.periodic(const Duration(milliseconds: 100), (x) => x)
      .listen((event) async {
    var duration = await getCurrentPosition();
    var total = await getDuration();
    var isPlay = await isPlaying();
    onPlayInfo?.call(Video360PlayInfo(
        duration: duration, total: total, isPlaying: isPlay));
  });

  await Video360Platform.instance.init(id, url, width, height, isRepeat);
}