在网站上上传视频文件会在iOS中抛出UIWebView [英] Uploading video file on website throw UIWebView in iOS

查看:131
本文介绍了在网站上上传视频文件会在iOS中抛出UIWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我要将视频上传到我的网站时,请使用<input file="type"/>抛出UIWebview.从照片库中拾取文件,并在发送之前将视频压缩到服务器.这在 UIWebview 中效果很好!但是,现在有摆脱这种压缩的方法了吗??已经向服务器发送了高质量的视频.

  1. 我尝试了多个库,例如dropzonejs,文件上传器,但是当从照片库上传视频时,似乎没有人可以在UIWebview中工作(由于以下原因,压缩步骤被跳过并且上传失败)文件大小等于0).

奇怪的是,从其他应用(如文档")上载视频时,无论哪种情况(UIWebview,Safari),一切都可以正常工作,因此在任何情况下都不会进行压缩,因此直接发送视频.

我也可以尝试:

  1. 在iPad上查看以禁用照片"中的某些首选项,但未找到任何内容.

  2. 我仅举一个简单的示例: http://www.dropzonejs.com/examples/simple.html 并进行了一些测试,似乎dropzone.js在Safari中可以很好地工作,但是在访问时抛出UIWebView则不能.

  3. 在UIWebview中加载vimeo网站并尝试上传视频,但也失败,因为视频大小无效(0B)

关于使用简单的<input file="type"/>(这是唯一在UIWebview中与照片库一起使用的照片)从照片库中挑选照片时如何避免压缩步骤的想法?

>

或者是否可以使用诸如dropzone.js之类的库并上传文件引发UIWebview.此外,每种类型的文件都可以工作(音乐和图像).只是视频未在UIWebview中正确处理.

解决方案

我发现可以通过将上传文件的最大数量限制为一个来解决该错误.

在Dropzone中,这意味着:

objFacilityDropzone = new Dropzone("#mainFileUploader",
    {
        url: "/posUrl",
        autoProcessQueue: false,
        addRemoveLinks: true,
        maxFilesize:100,
        acceptedFiles: "image/*,video/*,.mov,.mp4",
        maxFiles: 1,
   }

When I want to upload a video to my website, throw UIWebview using <input file="type"/> the files are picked from the Photo Library and the videos are compressed before being sent to the server. This works great in UIWebview! But now is there a way to get rid of that compression? a have a good quality video sent to the server.

  1. I try with multiple libraries like dropzonejs, file-uploader but no one seems to work in UIWebview when the videos are uploaded from the Photo Library (the compression step is skipped and the upload fail because of a file size that is equal to 0).

Strangely everything works fine in every case (UIWebview, Safari), when the video is uploaded from another app like (Documents) no compression done in any case so the video is sent directly.

What I also try:

  1. Look on iPad to disable some preferences in Photos and found nothing.

  2. I just take the simple example: http://www.dropzonejs.com/examples/simple.html and did some testing and it seems that dropzone.js works well in Safari but not when accessed throw UIWebView.

  3. Load the vimeo website in UIWebview and try to upload video, it also fail saying that the video size is not valid (0B)

Any idea on how can I avoid the compression step when the photo is picked from the Photo Library using the simple <input file="type"/> which is the only one that worked with Photo Library in UIWebview?

Or is there a way to use libraries like dropzone.js and upload file throw UIWebview. Moreover every type of file works (music and images). It is only videos that are not correctly handled in UIWebview.

解决方案

I found that a workaround to the bug can be done by limiting the max number of files uploaded to one.

In Dropzone this means:

objFacilityDropzone = new Dropzone("#mainFileUploader",
    {
        url: "/posUrl",
        autoProcessQueue: false,
        addRemoveLinks: true,
        maxFilesize:100,
        acceptedFiles: "image/*,video/*,.mov,.mp4",
        maxFiles: 1,
   }

这篇关于在网站上上传视频文件会在iOS中抛出UIWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆