简体   繁体   中英

How to SetSource to mediaElement in Windows Phone Silverlight 8.1 app?

I want to use this API https://msdn.microsoft.com/en-us/library/windows/apps/xaml/br244338.aspx

but it has got this requirements: Minimum supported phone Windows Phone 8.1 [Windows Runtime apps only]

My phone is wp8.1 and I am developing using wp silverlight 8.1.

Please what is the equivalent in wpSilverlight8.1?

I tried using PickSingleFileAndContinue() and it works fine until I get the video but I dont know how to get the stream in order to get the stream to assign to my mediaElement.

Thanks

found it and it work!

    public async void ContinueFileOpenPicker(FileOpenPickerContinuationEventArgs args)
    {
        StorageFile file = args.Files[0];

        if (file.Name.EndsWith("mp4")) {
            IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
            mediaControl.SetSource(fileStream, file.ContentType);
        ...
        }

got ideas from here: https://msdn.microsoft.com/en-us/library/windows/apps/dn642086(v=vs.105).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM