代码之家  ›  专栏  ›  技术社区  ›  Daibaku

Flitter Firebase存储视频旋转

  •  1
  • Daibaku  · 技术社区  · 7 年前

    我不确定这是不是 flutter Firebase Storage . 我用iPhone的肖像模式拍摄了视频并上传到 火基存储器 我上传视频并像这样播放。

    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)
     )
    

    有人知道怎么解决这个问题吗?

    1 回复  |  直到 7 年前