html - [src]="sermon?.sermonVideo" 不工作。虽然它适用于图片
问题描述
所以……我正在尝试从 data.json 获取我的页面上的视频
奇怪的是,如果我直接获取视频,它可以正常工作。
这是我的代码,然后我会解释更多。
html
<div class="sermon-background">
<div class="topRoom" >
<video controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline" class="videoPlayer">
<source [src]="sermon?.sermonVideo" type="video/mp4" />
</video>
</div>
<div class="topRoom2">
<svg width="100%" height="calc(1vw + 1vh + 6vmin)">
<rect width="100%" height="calc(1vw + 1vh + 6vmin)" style="fill:rgba(44, 44, 44, 0.548);stroke-width:0;stroke:rgb(60,200,160)" />
<text dominant-baseline="middle" text-anchor="middle" x="50%" y="55%" fill="white" style="font-size: calc(1vw + 1vh + 2vmin); font-family: 'Quicksand', sans-serif; font-weight: calc(.1vw + .1vh + .1vmin); text-shadow: 1px 1px 0px rgba(44, 44, 44, 0.445), 2px 2px 0px rgba(44, 44, 44,0.445), 3px 3px 0px rgba(44, 44, 44, 0.445) ">{{sermon?.name}}</text>
</svg>
</div >
<img [src]="sermon?.profilePic" [alt]="sermon?.name">
因此,使用相同方法来自同一位置的 profilePic 可以正常加载。
另外,如果我使用“src=assets/videos/Sermon1.mp4”,效果很好。
这是我的 data.json
"name": "Finding Grace",
"profilePic": "/assets/img/stuffs/PastorEvaFace.jpg",
"sermonVideo": "/assets/videos/Sermon1.mp4",
"about": "Learn to fnid Grace in every circumstance and realize just how much God has given you.",
"sum": "God has given us grace, we just need to open our eyes.",
"location": "Everywhere",
"id": "1"
有人知道为什么它不能运行视频吗?profilePic 运行良好...
我在尝试视频时收到错误“没有支持格式和 mime 类型的视频”
提前感谢您的高峰
解决方案
推荐阅读
- javascript - 根据在第二个数组中具有匹配记录的列名更改 javascript 中对象数组中的键名
- swift - 如何在 Swift 5 中创建我自己的 UIAlertController?
- python - Tkinter 窗口全宽而不被缩放
- java - Hadoop 计数问题中的 Map Reduce
- c# - C# VSTO - 在 ItemSend 事件处理程序中修改 MailItem?
- java - STS 未连接到 Marketplace
- python - Django 3.1.4 中的密码散列错误 - hashers.py
- flutter - Flutter:如何从浮动操作按钮调用小部件状态类的方法
- bash - jq - 使用 map 函数来保存当前排序的属性顺序
- html - 如何使 Bootstrap 卡拉伸到列内的屏幕高度?