locked
Launcher Problem With Media Center

    Question

  • I'm attempting to Launch a recorded TV file (.wtv) from a store app.  Media Center is installed on the machine and is the default for .wtv files.

    public async void play_button_Tapped(object sender, TappedRoutedEventArgs e) {
    var sf = await StorageFile.GetFileFromPathAsync(FULLPATH);

    var success = await Windows.System.Launcher.LaunchFileAsync(sf); if (success) { } else {
    var op = new Windows.System.LauncherOptions(); op.DisplayApplicationPicker = true;
    success = await Windows.System.Launcher.LaunchFileAsync(sf, op); } }

    FULLPATH is the full path to a wtv file.

    The first LaunchFileAsync fails (success == false)

    The second attempt displays the Application Picker for .wtv files and asks "Continue to use Media Center to open wtv files..."

    After selecting Media Center the Launch completes with Media Center playing the file specified at FULLPATH.

    Subsequent runs of this code work exactly the same with no change in behavior, it always fails without the picker.

    Obviously, it should work without the Application Picker, but it doesn't.  Does anyone see anything here?


    Rick Drasch Drasch Computer Software

    Saturday, March 21, 2015 7:08 PM

All replies

  • Hi Rick,

    >> Subsequent runs of this code work exactly the same with no change in behavior, it always fails without the picker.

    Based on my knowledge, app can access certain file system locations by default, such as application data locations, documents library, music library, picture library (declaring capabilities in app manifest). Other folders and files must be used by picker. In this case, the WTV file may sitting in the folder where your app has no access to read, so you need to use picker.

    To work around this problem, try copy that video file into video library, declare appropriate capability in app manifest and then use KnownFolders.VideosLibrary to access it. For more information, you can refer to see the following page. https://msdn.microsoft.com/en-us/library/windows/apps/Hh967755.aspx?f=255&MSPPError=-2147217396.

    Regards,


    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.

    Monday, March 23, 2015 6:23 AM
    Moderator
  • Thank you Herro,

    I changed the code slightly to use the Videos folder, I added Videos to Capabilities in the manifest, and I copied a wtv file to the videos folder.  Here is the code to access that file:

            public async void play_button_Tapped(object sender, TappedRoutedEventArgs e)
            {
                StorageFolder videos = KnownFolders.VideosLibrary;
                var sf = await videos.GetFileAsync("Angels.wtv");
    
                var success = await Windows.System.Launcher.LaunchFileAsync(sf); //First try
                if (success)
                {
                }
                else
                {
                    var op = new Windows.System.LauncherOptions();
                    op.DisplayApplicationPicker = true;
    
                    success = await Windows.System.Launcher.LaunchFileAsync(sf, op);
                }
            }

    Still doesn't work.

    I changed  the default file association from Media Center to Media Player and it still doesn't work.

    It seems to me that this represents a problem with the Launcher code and I guess I'll try and file a bug report.


    Rick Drasch Drasch Computer Software

    Tuesday, March 24, 2015 6:32 PM