从Firebase存储下载文件列表 [英] Downloading list of files from Firebase Storage

查看:79
本文介绍了从Firebase存储下载文件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想显示一个视频列表.为此,我正在寻找一种存储选项作为后端,我找到了可以存储视频和图像的Firebase Storage.

In my app I want to show a list of videos.For that I am looking for a storage option as backend and I found Firebase Storage which can store videos and images.

但是我如何从该存储中获取视频/图像列表?基本上我希望我的应用程序应包含缩略图列表,然后在单击缩略图时将播放相应的视频.

But how can i fetch list of videos/images from this storage?Basically I want that my app should contain list of thumbnails and on clicking on thumbnail respective video will play.

据我了解,firebase存储允许通过创建对该文件的引用来下载文件,这意味着要下载我需要创建对所有这些文件的引用的文件列表,并且Firebase存储不支持json.

By what I understand through doc is that firebase storage allows download file by creating a reference to that file.That means to download list of files I need to create reference to all those files.And Firebase storage doesn't support json.

那么我将如何在视频缩略图和它们各自的视频之间链接?如果Firebase Storage不能满足我的要求,那我应该使用什么?而且我不了解PHP,因此无法自己创建后端

So how will I link between video thumbnails and their respective video? If Firebase Storage is not ideal for my requirement then what should I use?And i have no knowledge of PHP so i can't create the backend myself

推荐答案

最简单的方法是将链接存储在Firebase数据库中.每次将图像/视频添加到Firebase存储时,还要在Firebase数据库中添加对该文件的引用.

The simplest way to achieve this is to store your links in a Firebase database. Every time you add an image/video to Firebase Storage, add also a reference to that file in the Firebase database.

您的数据库应如下所示:

Your database should look like this:

Firebase-root
    |
    --- videos
          |
          --- videoId1
          |      |
          |      --- videoLink: "https://..."
          |      |
          |      --- thumbnailLink: "https://..."
          |
          --- videoId2
          |      |
          |      --- videoLink: "https://..."
          |      |
          |      --- thumbnailLink: "https://..."
          |
          --- videoId3
                 |
                 --- videoLink: "https://..."
                 |
                 --- thumbnailLink: "https://..."

这篇关于从Firebase存储下载文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆