【问题标题】:Flutter Firebase Storage video gets rotatedFlutter Firebase Storage 视频被旋转
【发布时间】:2019-03-10 10:48:39
【问题描述】:

我不确定这是flutter 还是Firebase Storage。 我用我的 iPhone 肖像模式拍摄了视频并上传到Firebase Storage。当我播放该视频时,它会旋转。所以它看起来像视频被拉伸到屏幕上一样。我想如果您在横向模式下看到它看起来还不错,但是由于我禁用了我的应用程序来旋转,因此无法看到它正确的纵横比。 我上传视频并像这样播放。

Future _upload(File file) async {
  try {
      String now = DateTime.now().millisecondsSinceEpoch.toString();
      String storageId = (now + uid);
      String contentType = 'video/mp4';
      StorageReference ref = FirebaseStorage.instance.ref().child("video").child(storageId);
      StorageUploadTask uploadTask = ref.putFile(file, StorageMetadata(contentType: contentType));

      Uri downloadUrl = (await uploadTask.future).downloadUrl;
      String url = downloadUrl.toString();
      print(url);
    } catch (error) {
      print(error);
    }
  }



VideoPlayerController _controller;


new AspectRatio(
   aspectRatio: _controller.value.aspectRatio,
   child: new VideoPlayer(_controller)
 )

有谁知道如何解决这个问题?

【问题讨论】:

  • 如果你将 aspectRatio: _controller.value.aspectRatio 改为 aspectRatio: size.width / size.height,
  • 感谢您的评论!我试过你的纵横比,但看起来一样。我尝试了高度/宽度,然后变成了正确的纵横比。但关键是我不希望它被旋转。如果您使用纵向模式拍摄,那么我希望它是纵向的。你有什么想法吗?

标签: firebase dart flutter firebase-storage


【解决方案1】:

这似乎是这个已知问题https://github.com/flutter/flutter/issues/17606
带有待处理的拉取请求https://github.com/flutter/flutter/issues/17606#issuecomment-415621941

请投票以提高优先级。

【讨论】:

    猜你喜欢
    • 2021-04-16
    • 2011-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-20
    • 2018-08-22
    • 2021-03-08
    • 1970-01-01
    相关资源
    最近更新 更多