承接 deuxhuithuit/craft-cloudflare-stream 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

deuxhuithuit/craft-cloudflare-stream

最新稳定版本:2.3.0

Composer 安装命令:

composer require deuxhuithuit/craft-cloudflare-stream

包简介

Upload your videos assets to Cloudflare Stream from Craft CMS assets interface

README 文档

README

This plugin offers a easy way to upload your videos assets from Craft CMS to Cloudflare stream.

Installation

  1. Install with composer
composer require deuxhuithuit/craft-cloudflare-stream
  1. Install in craft
craft plugin/install cloudflare-stream
  1. Add your account id and api token in the settings. You can (and should) use env vars. Make sure to also choose your upload mechanism. If your volume does not have public urls, turn on form data upload. This is the recommended value, but not the default since not all hosts allows it.

  2. Create a new File System and a new Volume specific for streams. This is safer and will also allow you to turn off public urls as they are not required for streams to work.

  3. Create a new video stream Field and add it to your Asset data model.

  4. When editing an asset, you can now opt-in into sending videos in Cloudflare Stream. You can also enable auto-upload of stream in the settings.

  5. If your are using twig, with a field named stream you can access the stream data like so:

{% set value = asset.stream %}
<video controls style="width: 100%" poster="{{ value.thumbnail }}">
    {% if value.mp4Url and value.completed %}
        <source src="{{ value.mp4Url }}" type="video/mp4">
    {% endif %}
    {% if value.playback.hls %}
        <source src="{{ value.playback.hls }}" type="application/x-mpegURL">
    {% endif %}
    {% if value.playback.dash %}
        <source src="{{ value.playback.dash }}" type="application/dash+xml">
    {% endif %}
</video>
  1. If you are using graphql, there is a type registered to make it easy to request the proper data.
query MyQuery {
  asset(site: ["en"], volume: "stream") {
    url
    kind
    extension
    filename
    ... on stream_Asset {
      videoStream {
        uid
        name
        size
        thumbnailTimestampPct
        thumbnail
        preview
        hls
        dash
        mp4
        ready
        completed
        watermark {
          uid
          created
          downloadedFrom
          height
          name
          opacity
          padding
          position
          scale
          size
          width
        }
        input {
          width
          height
        }
      }
    }
  }
}
  1. You can also mass re-upload everything via Craft's cli. Please note that this creates new streams videos and is useful mainly when changing accounts.
./craft cloudflare-stream/reupload

This extension uses Craft's Queue system, so make sure it works properly.

Dealing with large files

Videos can be quite large, which makes uploading them a little trickier. Please make sure that Craft's and php's max upload limit are properly set.

If you still want to deal with larger file than what your host allows, you might want to try the Chunked Upload plugin to bypass your host restrictions. The plugin will use TUS when appropriated. The chunk size can be set by setting the CF_STREAM_TUS_CHUNK_SIZE env var to a value in bytes, in the 5 to 200 Mb range.

Made with ❤️ in Montréal.

(c) Deux Huit Huit

统计信息

  • 总下载量: 1.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固