适用于Windows Phone 8.1 Runtime的MediaLibrary API? [英] MediaLibrary APIs for Windows Phone 8.1 Runtime?

查看:99
本文介绍了适用于Windows Phone 8.1 Runtime的MediaLibrary API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows手机Silverlight(8和8.1)中,MediaLibrary类提供了大量的功能。但是在Windows Phone 8.1运行时,这些API似乎不存在。

In Windows phone silverlight (8 and 8.1) there are MediaLibrary class which offer a good number of functionalites. However in Windows phone 8.1 runtime these APIs don't seem to exist.

我知道我应该使用KnownFolder类来访问媒体文件。但是,我正在做一个加载和显示照片缩略图的图库应用程序。使用MediaLibrary类来获取缩略图的过程非常快,如果我想实现与
相同的事情,那么使用KnownFolder类这样做非常慢。

I know that I should use the KnownFolder class to access media files. However, I am doing a gallery app which loads and display photos thumbnails. The process of using the MediaLibrary class to get the thumbnails is very fast, and if I wanna achieve the same thing, doing so using the KnownFolder class is extremely slow.

这是使用medialibrary的代码:

This is the code using medialibrary:

private async void LoadPhotos() {
            MediaLibrary library = new MediaLibrary();
            PictureAlbum rootAlbum = library.RootPictureAlbum;
            var pictures = library.Pictures;
            foreach (var picture in pictures) {
                BitmapImage bm = new BitmapImage();
                bm.SetSource(picture.GetThumbnail());
                imagesList.Add(bm);
            }
}

这是使用KnownFolder的代码:

And this is the code using KnownFolder:

private async Task LoadPhotos() {
            StorageFolder PictureFolder = KnownFolders.CameraRoll;
            var files = await PictureFolder.GetFilesAsync();
            foreach (var file in files) {
                BitmapImage bm = new BitmapImage();
                bm.SetSource(file.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.PicturesView))
                imageList.Add(bm);
            }     

}


那么在Windows手机运行时有一个很好的方法吗?

So is there a good way in Windows phone runtime to do this?

推荐答案

嗨goaty92,

Hi goaty92,

那么,KnownFolders是您可以做的唯一选择Windows Phone运行时。 Windows Phone Sliverlight和Windows Phone Runtime是不同的东西,有关更多信息,请参考

Windows Phone Silverlight 8.1应用程序的平台兼容性和重大更改

Well, KnownFolders is the only choice that you can do in Windows Phone runtime. Windows Phone Sliverlight and Windows Phone Runtime are different thing, for more information, please ref to Platform compatibility and breaking changes for Windows Phone Silverlight 8.1 apps

- 詹姆斯


这篇关于适用于Windows Phone 8.1 Runtime的MediaLibrary API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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