简体   繁体   English

带有 .mov 的媒体文件未在cordova 应用程序中播放

[英]Media files with .mov are not playing in a cordova app

I am using Cordova to build my hybrid application.我正在使用 Cordova 构建我的混合应用程序。 In this application i have a functionality to show preview of files before uploading them to server.在这个应用程序中,我有一个功能可以在将文件上传到服务器之前显示文件的预览。 For this when i am uploading video files and audio files recorded from device, it works if i am playing video/audio from device storage url.为此,当我上传从设备录制的视频文件和音频文件时,如果我正在从设备存储 url 播放视频/音频,它就可以工作。 But it fails when i am binding the server url.但是当我绑定服务器 url 时它失败了。

First i thought it is issue with content-type received from server so i changed it to video/quicktime.首先,我认为这是从服务器收到的内容类型的问题,所以我将其更改为 video/quicktime。 Obviously it didn't solved my problem.显然它没有解决我的问题。

Video files with mp4 extensions are playing perfectly.带有 mp4 扩展名的视频文件正在完美播放。 As iPad is returning .mov file and no other way to change video extension i cannot change encoding type.由于 iPad 正在返回 .mov 文件并且没有其他方法可以更改视频扩展名,因此我无法更改编码类型。

My question is, what is issue when i am binding server url?我的问题是,当我绑定服务器 url 时有什么问题? it must not be issue with file codec as local file urls are playing without any issue.它一定不是文件编解码器的问题,因为本地文件 url 正在播放而没有任何问题。 Is it a limitation of iOS/Cordova where we need to download and run the file instead of binding it to html5 video tag?这是我们需要下载并运行文件而不是将其绑定到 html5 视频标签的 iOS/Cordova 的限制吗?

Is there any way where i can run these video files in an iOS/iPad device?有什么方法可以在 iOS/iPad 设备中运行这些视频文件吗?

I am using html5 and tags.我正在使用 html5 和标签。

When url is binding to video/audio tag i am getting below issue in Xcode console当 url 绑定到视频/音频标签时,我在 Xcode 控制台中遇到以下问题

服务器 API 网址

Server response for video file with .mov format .mov 格式视频文件的服务器响应

服务器响应

When i run the same video on Mac chrome browser it works.当我在 Mac chrome 浏览器上运行相同的视频时,它可以工作。 Only in case of mobile app it does not play media file.仅在移动应用程序的情况下,它不会播放媒体文件。 File is downloading as well when url is accessed directly.当直接访问 url 时,文件也在下载。

Please let me know if you need more information on this particular issue.如果您需要有关此特定问题的更多信息,请告诉我。

Details of platform平台详情

Cordova:科尔多瓦:

"cordova-android": "^8.0.0",
"cordova-browser": "^5.0.4",
"cordova-ios": "^4.5.5",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-opener2": "^3.0.0",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-media": "^5.0.2",
"cordova-plugin-media-capture": "^3.0.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "^1.3.3",

Html5 has official support for a VERY limited number of codecs and containers. Html5 官方支持数量非常有限的编解码器和容器。 Mp4/h264/aac is basically the only file that is guaranteed to work in all browsers. Mp4/h264/aac 基本上是唯一可以保证在所有浏览器中工作的文件。 Any other format and you must convert it.任何其他格式,您必须转换它。

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

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