微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Xamarin.iOS中的媒体元数据检索

如何解决Xamarin.iOS中的媒体元数据检索

在我的Xamarin.Forms应用程序中,我想对每个平台使用DependencyService来获取有关本地媒体文件的元数据,例如高度,宽度和旋转。这是我在Android中的操作方式:

public double ReturnVideoHeight(string mediaFilePath)
        {
            MediaMetadataRetriever reader = new MediaMetadataRetriever();
            reader.SetDataSource(mediaFilePath);

            var str = reader.ExtractMetadata(MetadataKey.VideoHeight);

            if (double.TryParse(str,out double num))
            {
                return num;
            }
            return -1;
        }

        public double ReturnVideoWidth(string mediaFilePath)
        {
            MediaMetadataRetriever reader = new MediaMetadataRetriever();
            reader.SetDataSource(mediaFilePath);

            var str = reader.ExtractMetadata(MetadataKey.VideoWidth);

            if (double.TryParse(str,out double num))
            {
                return num;
            }
            return -1;   

        }

        public string ReturnVideoRotation(string mediaFilePath)
        {
            MediaMetadataRetriever reader = new MediaMetadataRetriever();
            reader.SetDataSource(mediaFilePath);

            return reader.ExtractMetadata(MetadataKey.VideoRotation);
        }

我似乎找不到iOS库来完成同一件事。我该怎么办?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。