locked
StorageFile.Properties.GetMusicPropertiesAsync returns empty MusicProperties object

    Question

  • My Windows Store Desktop app has the following code:

    StorageFile file = await StorageFile.GetFileFromPathAsync(someValidMp3FilePath);
    MusicProperties musicProperties = await file.Properties.GetMusicPropertiesAsync();
    

    For some reason on one of my computers the returned MusicProperties object contains all null values:

        Album: ""

        AlbumArtist: ""

        Artist: ""

        Bitrate: 0

        Composers: Windows Runtime Object

    Conductors: Windows Runtime Object

        Duration: {00:00:00}

        Genre: Windows Runtime Object

        Producers: Windows Runtime Object

        Publisher: ""

        Rating: 0

        Subtitle: ""

        Title: ""

        TrackNumber: 0

        Writers: Windows Runtime Object

        Year: 0

    This is true for all media files, not just a specific one.

    On my laptop and Surface device this code works as expected. 

    When viewed from Windows Explorer, these fields look right.

    When viewed from FileOpenPicker (by hovering over the selected file) the correct values are also displayed.   

    I have also tried using StorageFile.GetBasicPropertiesAsync and retrieving the relevant properties - same result - empty.

    Is there an alternate (more robust) way of getting this information?

    Thanks,

    Yoav

    Tuesday, April 7, 2015 7:55 AM

Answers

  • Hi yoavf,

    Probably yes....I did not tried to run the app on the Mac with Windows installed, but probably the file storage system is different, perhaps its original file system lead to the difference, one is NTFS, another one is FAT?

    Personally I don't think we can solve it for you on the forum, if you need a more specific suggestion, you can consider about contact our payment support: https://getsupport.microsoft.com

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 16, 2015 1:40 AM
    Moderator

All replies

  • Hi Yoav,

    I cannot reproduce the issue by opening one music file from the music library, could you try following code to see if you still can get nothing?

                StorageFolder music = KnownFolders.MusicLibrary;
                StorageFile file = await music.GetFileAsync("1.mp3");
                MusicProperties musicProperties = await file.Properties.GetMusicPropertiesAsync();

    I'm not sure if someValidMp3FilePath means some local path or network path.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 8, 2015 3:36 AM
    Moderator
  • I would look at the following two things:

    1) Does your app have access to the music folder? Maybe try accessing a file in the app's own storage folder to test your code.

    2) Are you correctly awaiting the result of the async tasks? Step through the code and/or post more code to see if you're doing it correctly. I would imagine not awaiting the results could lead to null data.


    Visit http://blog.grogansoft.com/ for Windows development fun.

    Wednesday, April 8, 2015 10:59 AM
  • someValidMp3FilePath is a file in the Music library as in your example above.
    Might it be related to the fact that the only computer where this fails is a Mac with windows installed under bootcamp?

    Thursday, April 9, 2015 10:53 AM
  • The answer to both questions above is yes. As I mentioned this works correctly on my laptop and on my surface device, but not on my Windows on Mac
    Thursday, April 9, 2015 10:54 AM
  • Hi yoavf,

    Probably yes....I did not tried to run the app on the Mac with Windows installed, but probably the file storage system is different, perhaps its original file system lead to the difference, one is NTFS, another one is FAT?

    Personally I don't think we can solve it for you on the forum, if you need a more specific suggestion, you can consider about contact our payment support: https://getsupport.microsoft.com

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 16, 2015 1:40 AM
    Moderator