Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8136551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:47:43+00:00 2026-06-06T10:47:43+00:00

I need to play Music Library files using file URL, that I will set

  • 0

I need to play Music Library files using file URL, that I will set to MediaPlayer object in a XAML c# object.

I constructed URI as followed

StorageFile file = await KnownFolders.MusicLibrary.GetFileAsync(track.Id);

return new Uri("file:///" + file.Path);

URI looks like this: streamingUri = {file:///C:/Users/user/Music/04 – A Train Makes A Lonely Sound.mp3}

I need URL based scheme to play so that I can reuse same logic for web streaming too.

How do I make this work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:47:44+00:00Added an answer on June 6, 2026 at 10:47 am

    Take a look at
    this sample. It should give you some ideas of how to do media playback from file.

    While I notice you are saying you need a URI-based, you should use a stream for a local file. The only part you need to extract is a call to set the MediaElement’s Source. You can just make a function with 2 overrides and it should be relatively clean.

    So, for a web stream:

    void SetMediaElementSource(Uri webStreamUri)
    { 
        MyMediaElement.Source = webStreamUri;
    }
    

    And for a local file:

    void SetMediaElementSource(StorageFile file)
    {
        var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); 
        MyMediaElement.SetSource(stream, file.ContentType); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We need to play MP3 files in jPlayer without using Flash as a fallback.
What I'm doing : I need to play audio and video files that are
I have an aes encrypted mp3 file that I need to play in iOS;
I need a library that helps me manipulate a sound file playing in a
I need to play music file from the isolated storage. i did by this
I'm using libsndfile to load the music file and i use jack to play
I need to play long audio files using the Android SDK. I am aware
I am using AVAudioPlayer to play a 15 audio files. The audio files need
I need to play a part of an MP3 file in my java code.
I need to play and record at the same time. The problem is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.