如何从Laravel的存储中播放视频
我在存储文件夹中上传了一个视频文件,并将路径存储在数据库中。
我想在刀片上播放视频,但它不工作
video.blade.php
<video controls>
<source src="{{asset('storage/'. \App\Video::where('vid_id', $vid_id)->value('vid_path'))}}" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
通往视频的路径,
http://127.0.0.1:8000/storage/videos/2022_06_19_HmhR5cXugaEfvWe315Vi.mp4
文件成功上传但不播放
I uploaded a video file in the storage folder and stored the path in database.
I want to play the video on the blade but it is not working
video.blade.php
<video controls>
<source src="{{asset('storage/'. \App\Video::where('vid_id', $vid_id)->value('vid_path'))}}" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
Path to the video
http://127.0.0.1:8000/storage/videos/2022_06_19_HmhR5cXugaEfvWe315Vi.mp4
The file uploads successfully but it does not play
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将公共路径用于视频资产。我建议的是:
检查您是否可以直接从您提到的URL访问视频。
在您的代码段中,删除
&lt; source src =“ movie.ogg” type =“ video/ogg”&gt;
,除非您有该格式的movie.ogg资源使用url()或public_path()或public_path(),或资产()帮助者分配SRC
这样的东西:
You need to use the public path for the video asset. What I'd suggest:
Check if you can access the video directly from the URL that you mentioned.
In your code snippet, remove
<source src="movie.ogg" type="video/ogg">
unless you have a movie.ogg resource of that formatUse url(), or public_path(), or asset() helpers to assign the src
something like this: