checkRotation method

dynamic checkRotation()

Implementation

checkRotation() {
  FFprobeKit.getMediaInformation(widget.videoFile.path).then((session) async {
    final information = await session.getMediaInformation();

    if (information == null) {
      // CHECK THE FOLLOWING ATTRIBUTES ON ERROR
      final state =
          FFmpegKitConfig.sessionStateToString(await session.getState());
      final returnCode = await session.getReturnCode();
      final failStackTrace = await session.getFailStackTrace();
      final duration = await session.getDuration();
      final output = await session.getOutput();
    } else {
      // dev.log("output test : ${information.getStreams()[0]}");
      // dev.log("output test 2 : ${information.getStreams()[1]}");
      information.getStreams().forEach(
        (value) {
          if (value.getAllProperties() != null) {
            if (value.getAllProperties()?['side_data_list'] != null) {
              for (var data in value.getAllProperties()?['side_data_list']) {
                // dev.log("output side_data_list 2 : ${data['rotation']}");
                // dev.log("preview test 2 : ${data['rotation']}");
                _rotationAngle = data['rotation'] * 3.1416 / 180;
                setState(() {
                  // Convert rotation to radians for Flutter
                  // _rotationAngle = data['rotation'] * 3.1416 / 180;

                  // dev.log("sini ya test ${_rotationAngle}");
                });
              }
            }
          }
        },
      );

      // dev.log("output test3 : ${information.getAllProperties()}");
    }
  });
}