在上载视频以扩大托管量时,是否有一种特殊的视频通话方式? [英] Is there a special way to call videos when uploading to amplify hosting?
问题描述
我正在开发一个create-react-app项目,该项目应该在目标网页上显示背景视频.
I'm working on a create-react-app project, the project is supposed to show a background video on landing page.
它在localhost:3000上运行良好,但是当我上传以放大托管时,视频停止显示.
It is working perfectly on localhost:3000 but when I upload to amplify hosting, video stop showing.
我已经尝试直接通过此网址调用同一视频 http://ormuxwater.com/MobterVideo.mp4在开发人员控制台上通过修改DOM仍然无法显示任何内容,所以我想这不是文件夹文件位置问题
I already tried to call the same video directly from this url http://ormuxwater.com/MobterVideo.mp4 on the DOM by modifying it on developer console and it is still not showing anything, so my guess is that is not a folder file location problem
我也尝试过从其他地方调用它.首先尝试:从"../../assets/MobterVideo.mp4";
I also tried calling it from different places.
first try: import MobterVideo from "../../assets/MobterVideo.mp4";
<video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
<source src="{MobterVideo.mp4}" type="video/mp4" />
</video>
第二次尝试:
// calling it directly from public folder
<video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
<source src="/MobterVideo.mp4" type="video/mp4" />
</video>
上传到AWS Amplify时,是否需要采取一些措施使视频正常工作?控制台没有返回错误,我也不知道该怎么办
Is there something we need to take care for videos to work when uploading to aws amplify? console is not returning errors and I don't know what else to look
您可以在 https://mobter.mx
推荐答案
您必须将视频上传到AWS S3存储桶(云托管),然后才能保存文件,这是对我有用的唯一方法.尽管我猜您可以使用其他云托管服务,但是如果您使用Amplify,我想它对我们S3可能更好.以下是有关操作方法的说明:
You have to upload the video to an AWS S3 bucket (cloud hosting) and then you can src the file, that's the only way that worked for me; although I guess you could use a different cloud hosting service, but I guess it's probably better to us S3 if you're using Amplify. Here are the instruction on how to do it:
https://docs.sumerian.amazonaws.com/教程/create/beginner/s3-video/
您只需要步骤1&2
You should only need steps 1 & 2
这篇关于在上载视频以扩大托管量时,是否有一种特殊的视频通话方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!