Windows Phone 8 媒体选择器(照片和视频)类似于 Viber/WhatsApp [英] Windows Phone 8 Media Chooser (photo and video) similar to Viber/WhatsApp

查看:51
本文介绍了Windows Phone 8 媒体选择器(照片和视频)类似于 Viber/WhatsApp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一个应用,它类似于 iOS 和 Android 版本,从手机的媒体库/相机胶卷中选择一个视频.在 Android 和 iOS 中,这几乎没有问题,因为媒体可以为这些平台选择 API.

I have been developing an app which, similar to its iOS and Android versions, selects a video from the media library/camera roll of the phone. In Android and iOS this is almost no problem since media choosing APIs for those platforms are available.

对于我的情况,即 Windows Phone 8,我一直在网上搜索,甚至阅读 MSDN 文档,关于媒体选择器,您不仅可以选择照片,还可以选择相机胶卷中的视频,但幸运的是没有不可用,因为我读过.只有PhotoChooserTask可用,只能选择照片,不能选择视频.

For my case, which is Windows Phone 8, I have been searching over the web and even reading the MSDN documentations, about Media chooser, which you can choose not just photo but also video in the camera roll, but luckily there isn't available as I have read. Only the PhotoChooserTask is available and only photos not videos can be chosen.

在试图弄清楚是否真的有同时支持视频的媒体选择器时,我尝试查看了适用于 Windows Phone 8 的 WhatsApp 和 Viber 应用程序,令人惊讶的是,他们有这个选择媒体"选择器.他们的媒体选择器"看起来几乎一样,并且具有选择视频的能力.

While trying to figure out if there is really a media chooser with both video support, I have tried looking over the WhatsApp and Viber apps for Windows Phone 8, and surprisingly, they have this "Choose Media" picker. Their 'media chooser' both look almost the same, and has the ability to pick video.

这些是来自 Viber/WhatsApp 的选择媒体"选择器的屏幕截图:

These are the screenshots from the Viber/WhatsApp's "Choose Media" chooser:

WhatsApp 的选择媒体"

Viber 的选择媒体"

我的问题是那是什么类型的控件/选择器 API?还是像第三方付费图书馆之类的东西?还是开源的?已经沮丧地寻找了几天,但仍然没有找到一个.

My question is what type of control/chooser API is that? Or is it something like third party paid library ? Or an open source one? Have been frustated searching for days but still no luck finding one.

推荐答案

在 Windows Phone 8 中,遗憾的是,第三方开发人员无法使用允许访问媒体库以获取预先录制的视频的 API.Microsoft 仅允许少数应用编辑器(WhatsApp 等)使用隐藏的 API.

In Windows Phone 8, the API that allows to access the media library to fetch pre-recorded videos is unfortunately not available for third party developers. Microsoft gave the permission to use a hidden API to a few app editors only (WhatsApp, etc.).

但是,在 Windows Phone 8.1(商店应用程序)中情况发生了变化,您有一个 API 允许选择文件,并且您可以指定您想要的视频文件.

However things change in Windows Phone 8.1 (Store apps) where you have an API that allows file selection and you can specifiy that you want video files.

示例代码:

var openPicker = new Windows.Storage.Pickers.FileOpenPicker();

openPicker.FileTypeFilter.Add(".wmv");
openPicker.FileTypeFilter.Add(".mp4");

var file = await openPicker.PickSingleFileAsync();

这篇关于Windows Phone 8 媒体选择器(照片和视频)类似于 Viber/WhatsApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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