locked
[WP8.1]Accessing Windows Phone 8.1 music library like Windows Phone 8 RRS feed

  • Question

  • It appears that with Windows Phone 8 the system was responsible for keeping track of all library items such as music and videos. While it was limiting in certain aspects, you got the benefit that any music or video player app could immediately list the songs and videos on the phone without having to create their own song database for example, and syncing it with the file system.

    On Windows Phone 8.1 I envy this very much. Apps written for WP8 run on 8.1 and immediately list library items indicating the system underneath is still managing libraries, but apps written for 8.1 are always refreshing lists and caching album art as if there is no access to said library that is already being managed by the system.

    Is there a way to get the WP8 behavior (access the system managed library) regarding media items - music specifically - on WP8.1?

    P.S. I am aware that WP is over. I need to target this platform right now regardless.


    Wednesday, February 22, 2017 11:19 AM

All replies

  • Are you using a wp 8.1 silverlight or winrt app?  I would think you would get the same behavior in the silverlight wp8.1 app
    Wednesday, February 22, 2017 3:25 PM
  • It's a WinRT app as the features added to WinRT were very important to the app. Is there a way to access the internal library from WinRT or is that completely out of the question?

    I'll take any native code "hack" too, if you can suggest them.

    Friday, February 24, 2017 1:05 AM
  • Hello AgentTheGreat,

    To me I always use the following code the access files and I haven't tried to see whether music will behave like this(And as you've said we always use UWP)

    StorageFolder storageFolder = KnownFolders.PicturesLibrary;

    Do you have some code to describe your problem so that I can try reproduce on a emulator?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 3, 2017 9:33 AM
  • Hello Barry,

    Yes that is the code to access the files on WP 8.1. But the problem is that when you use that code on 8.1, basically you're asking the OS to walk through and scan all files to retrieve a list of songs for example. On an average phone (my Lumia 1320) and say, 1000 songs, it takes a couple of minutes to return all songs (asking for song meta data like artist, etc. takes much longer too) and this is not the performance to allow the user to quickly search within their songs.

    The solution is to scan the files and store the meta data in a database. That requires keeping the database in sync with the files, which means continuous scanning and having an algorithm that can figure out when files have been added, removed, relocated or renamed. That's a lot of battery use on top of a difficult implementation. Plus the scan can only work when the app is running. (I am not sure if I'm allowed to do it as a background process on WP 8.1 and have the scan run while my app is terminated)

    We know the system is handling all of this in a central location: it is keeping a database of all library items on both WP8 and WP8.1. We know this because multimedia apps written for WP8 do in fact retrieve library items instantaneously even on 8.1.

    I am asking to see if there is a way to get the WP8 behavior (accessing the system managed library) in an app written for WinRT on WP 8.1.


    • Edited by AgentTheGreat Saturday, March 4, 2017 8:25 AM Added details
    Friday, March 3, 2017 10:20 AM
  • Hello again Barry

    So you have no suggestions?

    Saturday, March 18, 2017 9:14 PM