简体   繁体   English

使用 iPhone 或 iPad 无法在 Safari 上播放 Quicktime 视频

[英]Quicktime video not playing on Safari using iPhone or iPad

I have a website that let's my users load videos.我有一个网站,让我的用户加载视频。 I have a simple file input form.我有一个简单的文件输入表单。 Since users are all mobile or tablet users the phone or tablet prompts them (via the browser) to record a video that will be used as the input.由于用户都是手机或平板电脑用户,手机或平板电脑会提示他们(通过浏览器)录制将用作输入的视频。

<input type="file" id="ikid-foto" name="ikid-foto" accept="image/*,video/mp4">

I then allow them to preview the video:然后我允许他们预览视频:

var fileItem = document.getElementById('ikid-foto');
var files = fileItem.files;
var file = files[0];
var url = URL.createObjectURL(file);
var video = document.getElementsByTagName('video')[0];
video.src = url;
video.load();

I then use jQuery.ajax to store the video file on the server.然后我使用 jQuery.ajax 将视频文件存储在服务器上。 On another page I let the user view the video he has previously loaded in the site, this is simply done by putting the url of the video as source to an htm video html tag.在另一个页面上,我让用户查看他之前在站点中加载的视频,这只需将视频的 url 作为源添加到 htm 视频 html 标签即可。

<video width="300" height="225" src="<?php echo wp_get_attachment_url($foto);?>" controls playsinline type="video/mp4"></video>

This usually works with no issues.这通常没有问题。 But there is an exception.但有一个例外。

Since users use different browsers and devices I get some users that upload videos with file type video/mp4 files, but other upload video/quicktime videos.由于用户使用不同的浏览器和设备,我得到一些用户上传文件类型为 video/mp4 文件的视频,但其他用户上传视频/quicktime 视频。

The problem occurs on some cases of video/quicktime videos.某些视频/quicktime 视频会出现此问题。

If the user is on an iPhone or iPad and he is using a Safari browser he is unable to view the videos once they have been uploaded to the server.如果用户使用的是 iPhone 或 iPad,并且他使用的是 Safari 浏览器,则一旦视频上传到服务器,他将无法观看视频。 So, if the user is on an iPad with Safari he can upload the video he is recording.因此,如果用户使用 iPad 和 Safari,他可以上传他正在录制的视频。 That quicktime video will be shown on the preview.该 quicktime 视频将显示在预览中。 But when he browses a page that want to play that video the video is not shown.但是当他浏览要播放该视频的页面时,视频没有显示。 If that same quicktime video that has been uploaded to the server is viewed from a device that is not an iPhone or an iPad it can be viewed with no issues.如果从 iPhone 或 iPad 以外的设备观看已上传到服务器的同一 quicktime 视频,则可以毫无问题地观看。 Also, if the I try to view the quicktime video from an iPad or iPhone but I use Chrome instead, I CAN view the video.此外,如果我尝试从 iPad 或 iPhone 查看 quicktime 视频,但我改用 Chrome,我可以查看视频。

I have read other questions with similar problems that indicate to use the playsinline parameter in the html video tag, but with no success.我读过其他有类似问题的问题,这些问题表明在 html 视频标签中使用 playsinline 参数,但没有成功。 I've tried other options and no change.我尝试了其他选项,但没有任何改变。

My website is a wordpress site.我的网站是 wordpress 站点。 I tried to download the quicktime video that was recorded on an iPad and directly upload it to my web site server.我尝试下载在iPad上录制的quicktime视频,直接上传到我的web站点服务器。 I then tried to see the video from the wordpress admin panel for media and Wordpress does not show the video.然后我尝试从 wordpress 媒体管理面板查看视频,Wordpress 不显示该视频。

Any thoughts on what to do so I can have iPhone and iPad users record videos and have them be able to see them later after storing on my server?有什么想法可以让 iPhone 和 iPad 用户录制视频并让他们在存储到我的服务器后稍后能够看到它们吗?

Found out that it was a plugin causing the issue.发现这是一个导致问题的插件。 The Super Progressive Web Apps plugin was generating a conflict with Safari in the way it used it's service worker. Super Progressive Web Apps 插件在使用 service worker 的方式上与 Safari 产生了冲突。 Issue not solved yet.问题还没有解决。

https://wordpress.org/support/topic/it-will-cause-issue-media-error-formats-not-supported-or-sources/ https://wordpress.org/support/topic/it-will-cause-issue-media-error-formats-not-supported-or-sources/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM