deuxhuithuit/craft-cloudflare-stream
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
- Install with composer
composer require deuxhuithuit/craft-cloudflare-stream
- Install in craft
craft plugin/install cloudflare-stream
-
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.
-
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.
-
Create a new video stream Field and add it to your Asset data model.
-
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.
-
If your are using twig, with a field named
streamyou 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>
- 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 } } } } }
- 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
deuxhuithuit/craft-cloudflare-stream 适用场景与选型建议
deuxhuithuit/craft-cloudflare-stream 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.3k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 07 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「stream」 「video」 「cloudflare」 「craft-cms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 deuxhuithuit/craft-cloudflare-stream 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 deuxhuithuit/craft-cloudflare-stream 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 deuxhuithuit/craft-cloudflare-stream 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
Object-Oriented API for PHP streams
Safely namespaced guzzle psr7 for WP2Static
The yii2-videojs-widget is a Yii 2 wrapper for the [video.js](http://www.videojs.com/). A JavaScript and CSS library that makes it easier to work with and build on HTML5 video. This is also known as an HTML5 Video Player.
Symfony bundle for Cloudflare integration: trusted proxies, real client IP detection, forwarded headers.
Interface for a factory to create Psr\Http\Message\StreamInterface objects
统计信息
- 总下载量: 1.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2023-07-24