예제 #1
0
        //public static Task<TimeSpan> StreamDuration(this MediaElement element, Stream stream) {
        //    using(var stream = await file.OpenReadAsync()) {
        //        return element.Duration(stream, (e, s) => e.SetSource(s, s.ContentType));
        //    }
        //}
        public static async Task <TimeSpan> UriDuration(this MediaElement element, Uri uri)
        {
            var file = await StoreFileUtils.GetFile(uri);

            if (file != null)
            {
                return(await element.FileDuration(file));
            }
            else
            {
                return(await element.Duration(uri, (e, u) => e.Source = u));
            }
        }
예제 #2
0
 public static async Task <TimeSpan> FileDuration(this MediaElement element, StorageFile file)
 {
     using (var stream = await file.OpenReadAsync()) {
         return(await element.Duration(stream, (e, s) => e.SetSource(s, s.ContentType)));
     }
 }