iOS / Cordova HTML5-视频未播放
iOS / Cordova HTML5-Video not playing
我的 meteor / cordova 应用程序下载视频以离线播放。
下载正常。 Android 工作正常...但是 iOS 不行..
我尝试了本地绝对 URLs: file:///...
但我得到 Not allowed to load local resource Error
所以我像 Android 一样使用 cordova-httpd,但这也不起作用, 没有任何错误 (http://127.0.0.1:8880/ oder http://192.168.2.100:8880)。如果我在浏览器或 curl 中打开 URL,我可以 view/download 视频,所以 httpd 服务器似乎可以工作。我试过真实 iPhone 和 iOS 模拟器。
直接从 remote/internet 播放视频。
我试过这个 HTML 片段:
<div class="video-container">
<video src="{{video_url}}" type="video/mp4" width="100%" controls="controls">
</video>
<button class="ion-play play-button"></button>
</div>
和
<div class="video-container">
<video width="100%" controls="controls">
<source src="{{video_url}}" type="video/mp4" />
</video>
<button class="ion-play play-button"></button>
</div>
在过去的几天里,我在 github 上阅读了很多问题并在 Whosebug 上发表了评论,但我无法让它工作。
(顺便说一下,点击按钮也会触发视频)
Template.Content.events({
"click .play-button": function (event) {
// Prevent default browser form submit
event.preventDefault();
event.target.classList.add('playing');
var video = event.target.parentNode.getElementsByTagName('video')[0];
video.load();
video.play();
}
});
拜托,有什么建议吗?
我发现了问题。我的 url 有一个双斜杠 (http://192.168.0.100:8880//videos/some.mp4),在 iOS 上 HTTP-Server 返回了 404 错误。
由此解决
Play video cordova
我的 meteor / cordova 应用程序下载视频以离线播放。
下载正常。 Android 工作正常...但是 iOS 不行..
我尝试了本地绝对 URLs: file:///...
但我得到 Not allowed to load local resource Error
所以我像 Android 一样使用 cordova-httpd,但这也不起作用, 没有任何错误 (http://127.0.0.1:8880/ oder http://192.168.2.100:8880)。如果我在浏览器或 curl 中打开 URL,我可以 view/download 视频,所以 httpd 服务器似乎可以工作。我试过真实 iPhone 和 iOS 模拟器。
直接从 remote/internet 播放视频。
我试过这个 HTML 片段:
<div class="video-container">
<video src="{{video_url}}" type="video/mp4" width="100%" controls="controls">
</video>
<button class="ion-play play-button"></button>
</div>
和
<div class="video-container">
<video width="100%" controls="controls">
<source src="{{video_url}}" type="video/mp4" />
</video>
<button class="ion-play play-button"></button>
</div>
在过去的几天里,我在 github 上阅读了很多问题并在 Whosebug 上发表了评论,但我无法让它工作。
(顺便说一下,点击按钮也会触发视频)
Template.Content.events({
"click .play-button": function (event) {
// Prevent default browser form submit
event.preventDefault();
event.target.classList.add('playing');
var video = event.target.parentNode.getElementsByTagName('video')[0];
video.load();
video.play();
}
});
拜托,有什么建议吗?
我发现了问题。我的 url 有一个双斜杠 (http://192.168.0.100:8880//videos/some.mp4),在 iOS 上 HTTP-Server 返回了 404 错误。
由此解决 Play video cordova