How to combine audio and video tracks for playback or get StorageFile from the web?












-2















I develop YouTube UWP client and I need to combine video and audio tracks (muxed files are only with 480p and lower). But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)



I use Visual Studio 2019 Preview on x64 machine. Minimum target version is Fall Creators Update and target is October 2018 update.



What did I try:




  • Upgrade minimum version to October 2018 Update


  • Use StorageFile.GetFileFromApplicationUriAsync(Uri) instead of StorageFile.GetFileFromPathAsync(string).



Then it rises




System.ArgumentException: 'Value does not fall within the expected range.'




According to Microsoft documentation (https://docs.microsoft.com/ru-ru/dotnet/api/system.io.pathtoolongexception?view=netframework-4.7.2):




this exception may be caused by framework incompability but in UWP apps there is no obvious way to directly change target framework.




Here's my code:



MediaComposition muxedStream = new MediaComposition();

BackgroundAudioTrack audioTrack = await BackgroundAudioTrack.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(audioInfo.Url)); //Trying to get file throws an exception
MediaClip videoTrack = await MediaClip.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(videoInfo.Url));

muxedStream.BackgroundAudioTracks.Add(audioTrack);
muxedStream.Clips.Add(videoTrack);

videoSource.SetMediaStreamSource(muxedStream.GenerateMediaStreamSource());


I need to somehow bypass this exception or find another way to combine streams.



Url sample: https://r9---sn-n8v7znsz.googlevideo.com/videoplayback?mime=video%2Fmp4&expire=1546167117&lmt=1543098677581810&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C298%2C299%2C302%2C303&sparams=aitags,clen,dur,ei,expire,gir,id,ip,ipbits,ipbypass,itag,keepalive,lmt,mime,mip,mm,mn,ms,mv,nh,pl,requiressl,source&key=cms1&pl=24&ipbits=0&txp=5532432&keepalive=yes&itag=137&requiressl=yes&ei=7U4oXNOULs-fyAWHl74I&ip=95.47.116.128&c=WEB&gir=yes&dur=274.999&id=o-ACk7-_Fgu_caJbjuRbtlayK-dgmNtLEqypLyLfwWbA2j&signature=8173BAF30157D47064F9BE1DB85CB5A910AA5008.28DA3ACEEE47AD89D56E1F162602C99D73751E02&source=youtube&clen=102247371&fvip=15&video_id=xO_XyOsHK6A&title=WOLFENSTEIN+2+SONG+%28COLOSSAL+CARNAGE%29+LYRIC+VIDEO+-+DAGames&rm=sn-uixgxjvh-ig3e7e,sn-3c2ed7y&fexp=23763603&req_id=69d1c8f74394a3ee&redirect_counter=2&cms_redirect=yes&ipbypass=yes&mip=5.187.79.66&mm=29&mn=sn-n8v7znsz&ms=rdu&mt=1546157635&mv=m&nh=IgpwcjA0LnN2bzA2KgkxMjcuMC4wLjE&ir=1&rr=12 (976 characters)










share|improve this question

























  • Could you use HttpClient instead, and use StorageFile with a stream from an httpResponse.Content.ReadAsStreamAsync()?

    – Matthew
    Dec 31 '18 at 21:58






  • 2





    Don't use StorageFile to download a web resource. stackoverflow.com/a/37806443/17034

    – Hans Passant
    Dec 31 '18 at 21:58











  • @HansPassant, I do not need to download files. I need to stream them. At least because downloading will take much more time than streaming and combining them on the run

    – XFox
    Dec 31 '18 at 22:04











  • @Matthew, could you provide a bit more details, please?

    – XFox
    Dec 31 '18 at 22:05











  • That's awfully vague, google something like "uwp stream audio" to find relevant hits.

    – Hans Passant
    Dec 31 '18 at 22:06
















-2















I develop YouTube UWP client and I need to combine video and audio tracks (muxed files are only with 480p and lower). But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)



I use Visual Studio 2019 Preview on x64 machine. Minimum target version is Fall Creators Update and target is October 2018 update.



What did I try:




  • Upgrade minimum version to October 2018 Update


  • Use StorageFile.GetFileFromApplicationUriAsync(Uri) instead of StorageFile.GetFileFromPathAsync(string).



Then it rises




System.ArgumentException: 'Value does not fall within the expected range.'




According to Microsoft documentation (https://docs.microsoft.com/ru-ru/dotnet/api/system.io.pathtoolongexception?view=netframework-4.7.2):




this exception may be caused by framework incompability but in UWP apps there is no obvious way to directly change target framework.




Here's my code:



MediaComposition muxedStream = new MediaComposition();

BackgroundAudioTrack audioTrack = await BackgroundAudioTrack.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(audioInfo.Url)); //Trying to get file throws an exception
MediaClip videoTrack = await MediaClip.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(videoInfo.Url));

muxedStream.BackgroundAudioTracks.Add(audioTrack);
muxedStream.Clips.Add(videoTrack);

videoSource.SetMediaStreamSource(muxedStream.GenerateMediaStreamSource());


I need to somehow bypass this exception or find another way to combine streams.



Url sample: https://r9---sn-n8v7znsz.googlevideo.com/videoplayback?mime=video%2Fmp4&expire=1546167117&lmt=1543098677581810&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C298%2C299%2C302%2C303&sparams=aitags,clen,dur,ei,expire,gir,id,ip,ipbits,ipbypass,itag,keepalive,lmt,mime,mip,mm,mn,ms,mv,nh,pl,requiressl,source&key=cms1&pl=24&ipbits=0&txp=5532432&keepalive=yes&itag=137&requiressl=yes&ei=7U4oXNOULs-fyAWHl74I&ip=95.47.116.128&c=WEB&gir=yes&dur=274.999&id=o-ACk7-_Fgu_caJbjuRbtlayK-dgmNtLEqypLyLfwWbA2j&signature=8173BAF30157D47064F9BE1DB85CB5A910AA5008.28DA3ACEEE47AD89D56E1F162602C99D73751E02&source=youtube&clen=102247371&fvip=15&video_id=xO_XyOsHK6A&title=WOLFENSTEIN+2+SONG+%28COLOSSAL+CARNAGE%29+LYRIC+VIDEO+-+DAGames&rm=sn-uixgxjvh-ig3e7e,sn-3c2ed7y&fexp=23763603&req_id=69d1c8f74394a3ee&redirect_counter=2&cms_redirect=yes&ipbypass=yes&mip=5.187.79.66&mm=29&mn=sn-n8v7znsz&ms=rdu&mt=1546157635&mv=m&nh=IgpwcjA0LnN2bzA2KgkxMjcuMC4wLjE&ir=1&rr=12 (976 characters)










share|improve this question

























  • Could you use HttpClient instead, and use StorageFile with a stream from an httpResponse.Content.ReadAsStreamAsync()?

    – Matthew
    Dec 31 '18 at 21:58






  • 2





    Don't use StorageFile to download a web resource. stackoverflow.com/a/37806443/17034

    – Hans Passant
    Dec 31 '18 at 21:58











  • @HansPassant, I do not need to download files. I need to stream them. At least because downloading will take much more time than streaming and combining them on the run

    – XFox
    Dec 31 '18 at 22:04











  • @Matthew, could you provide a bit more details, please?

    – XFox
    Dec 31 '18 at 22:05











  • That's awfully vague, google something like "uwp stream audio" to find relevant hits.

    – Hans Passant
    Dec 31 '18 at 22:06














-2












-2








-2








I develop YouTube UWP client and I need to combine video and audio tracks (muxed files are only with 480p and lower). But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)



I use Visual Studio 2019 Preview on x64 machine. Minimum target version is Fall Creators Update and target is October 2018 update.



What did I try:




  • Upgrade minimum version to October 2018 Update


  • Use StorageFile.GetFileFromApplicationUriAsync(Uri) instead of StorageFile.GetFileFromPathAsync(string).



Then it rises




System.ArgumentException: 'Value does not fall within the expected range.'




According to Microsoft documentation (https://docs.microsoft.com/ru-ru/dotnet/api/system.io.pathtoolongexception?view=netframework-4.7.2):




this exception may be caused by framework incompability but in UWP apps there is no obvious way to directly change target framework.




Here's my code:



MediaComposition muxedStream = new MediaComposition();

BackgroundAudioTrack audioTrack = await BackgroundAudioTrack.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(audioInfo.Url)); //Trying to get file throws an exception
MediaClip videoTrack = await MediaClip.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(videoInfo.Url));

muxedStream.BackgroundAudioTracks.Add(audioTrack);
muxedStream.Clips.Add(videoTrack);

videoSource.SetMediaStreamSource(muxedStream.GenerateMediaStreamSource());


I need to somehow bypass this exception or find another way to combine streams.



Url sample: https://r9---sn-n8v7znsz.googlevideo.com/videoplayback?mime=video%2Fmp4&expire=1546167117&lmt=1543098677581810&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C298%2C299%2C302%2C303&sparams=aitags,clen,dur,ei,expire,gir,id,ip,ipbits,ipbypass,itag,keepalive,lmt,mime,mip,mm,mn,ms,mv,nh,pl,requiressl,source&key=cms1&pl=24&ipbits=0&txp=5532432&keepalive=yes&itag=137&requiressl=yes&ei=7U4oXNOULs-fyAWHl74I&ip=95.47.116.128&c=WEB&gir=yes&dur=274.999&id=o-ACk7-_Fgu_caJbjuRbtlayK-dgmNtLEqypLyLfwWbA2j&signature=8173BAF30157D47064F9BE1DB85CB5A910AA5008.28DA3ACEEE47AD89D56E1F162602C99D73751E02&source=youtube&clen=102247371&fvip=15&video_id=xO_XyOsHK6A&title=WOLFENSTEIN+2+SONG+%28COLOSSAL+CARNAGE%29+LYRIC+VIDEO+-+DAGames&rm=sn-uixgxjvh-ig3e7e,sn-3c2ed7y&fexp=23763603&req_id=69d1c8f74394a3ee&redirect_counter=2&cms_redirect=yes&ipbypass=yes&mip=5.187.79.66&mm=29&mn=sn-n8v7znsz&ms=rdu&mt=1546157635&mv=m&nh=IgpwcjA0LnN2bzA2KgkxMjcuMC4wLjE&ir=1&rr=12 (976 characters)










share|improve this question
















I develop YouTube UWP client and I need to combine video and audio tracks (muxed files are only with 480p and lower). But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)



I use Visual Studio 2019 Preview on x64 machine. Minimum target version is Fall Creators Update and target is October 2018 update.



What did I try:




  • Upgrade minimum version to October 2018 Update


  • Use StorageFile.GetFileFromApplicationUriAsync(Uri) instead of StorageFile.GetFileFromPathAsync(string).



Then it rises




System.ArgumentException: 'Value does not fall within the expected range.'




According to Microsoft documentation (https://docs.microsoft.com/ru-ru/dotnet/api/system.io.pathtoolongexception?view=netframework-4.7.2):




this exception may be caused by framework incompability but in UWP apps there is no obvious way to directly change target framework.




Here's my code:



MediaComposition muxedStream = new MediaComposition();

BackgroundAudioTrack audioTrack = await BackgroundAudioTrack.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(audioInfo.Url)); //Trying to get file throws an exception
MediaClip videoTrack = await MediaClip.CreateFromFileAsync(await StorageFile.GetFileFromPathAsync(videoInfo.Url));

muxedStream.BackgroundAudioTracks.Add(audioTrack);
muxedStream.Clips.Add(videoTrack);

videoSource.SetMediaStreamSource(muxedStream.GenerateMediaStreamSource());


I need to somehow bypass this exception or find another way to combine streams.



Url sample: https://r9---sn-n8v7znsz.googlevideo.com/videoplayback?mime=video%2Fmp4&expire=1546167117&lmt=1543098677581810&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C298%2C299%2C302%2C303&sparams=aitags,clen,dur,ei,expire,gir,id,ip,ipbits,ipbypass,itag,keepalive,lmt,mime,mip,mm,mn,ms,mv,nh,pl,requiressl,source&key=cms1&pl=24&ipbits=0&txp=5532432&keepalive=yes&itag=137&requiressl=yes&ei=7U4oXNOULs-fyAWHl74I&ip=95.47.116.128&c=WEB&gir=yes&dur=274.999&id=o-ACk7-_Fgu_caJbjuRbtlayK-dgmNtLEqypLyLfwWbA2j&signature=8173BAF30157D47064F9BE1DB85CB5A910AA5008.28DA3ACEEE47AD89D56E1F162602C99D73751E02&source=youtube&clen=102247371&fvip=15&video_id=xO_XyOsHK6A&title=WOLFENSTEIN+2+SONG+%28COLOSSAL+CARNAGE%29+LYRIC+VIDEO+-+DAGames&rm=sn-uixgxjvh-ig3e7e,sn-3c2ed7y&fexp=23763603&req_id=69d1c8f74394a3ee&redirect_counter=2&cms_redirect=yes&ipbypass=yes&mip=5.187.79.66&mm=29&mn=sn-n8v7znsz&ms=rdu&mt=1546157635&mv=m&nh=IgpwcjA0LnN2bzA2KgkxMjcuMC4wLjE&ir=1&rr=12 (976 characters)







c# uwp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 19:09







XFox

















asked Dec 31 '18 at 21:51









XFoxXFox

296




296













  • Could you use HttpClient instead, and use StorageFile with a stream from an httpResponse.Content.ReadAsStreamAsync()?

    – Matthew
    Dec 31 '18 at 21:58






  • 2





    Don't use StorageFile to download a web resource. stackoverflow.com/a/37806443/17034

    – Hans Passant
    Dec 31 '18 at 21:58











  • @HansPassant, I do not need to download files. I need to stream them. At least because downloading will take much more time than streaming and combining them on the run

    – XFox
    Dec 31 '18 at 22:04











  • @Matthew, could you provide a bit more details, please?

    – XFox
    Dec 31 '18 at 22:05











  • That's awfully vague, google something like "uwp stream audio" to find relevant hits.

    – Hans Passant
    Dec 31 '18 at 22:06



















  • Could you use HttpClient instead, and use StorageFile with a stream from an httpResponse.Content.ReadAsStreamAsync()?

    – Matthew
    Dec 31 '18 at 21:58






  • 2





    Don't use StorageFile to download a web resource. stackoverflow.com/a/37806443/17034

    – Hans Passant
    Dec 31 '18 at 21:58











  • @HansPassant, I do not need to download files. I need to stream them. At least because downloading will take much more time than streaming and combining them on the run

    – XFox
    Dec 31 '18 at 22:04











  • @Matthew, could you provide a bit more details, please?

    – XFox
    Dec 31 '18 at 22:05











  • That's awfully vague, google something like "uwp stream audio" to find relevant hits.

    – Hans Passant
    Dec 31 '18 at 22:06

















Could you use HttpClient instead, and use StorageFile with a stream from an httpResponse.Content.ReadAsStreamAsync()?

– Matthew
Dec 31 '18 at 21:58





Could you use HttpClient instead, and use StorageFile with a stream from an httpResponse.Content.ReadAsStreamAsync()?

– Matthew
Dec 31 '18 at 21:58




2




2





Don't use StorageFile to download a web resource. stackoverflow.com/a/37806443/17034

– Hans Passant
Dec 31 '18 at 21:58





Don't use StorageFile to download a web resource. stackoverflow.com/a/37806443/17034

– Hans Passant
Dec 31 '18 at 21:58













@HansPassant, I do not need to download files. I need to stream them. At least because downloading will take much more time than streaming and combining them on the run

– XFox
Dec 31 '18 at 22:04





@HansPassant, I do not need to download files. I need to stream them. At least because downloading will take much more time than streaming and combining them on the run

– XFox
Dec 31 '18 at 22:04













@Matthew, could you provide a bit more details, please?

– XFox
Dec 31 '18 at 22:05





@Matthew, could you provide a bit more details, please?

– XFox
Dec 31 '18 at 22:05













That's awfully vague, google something like "uwp stream audio" to find relevant hits.

– Hans Passant
Dec 31 '18 at 22:06





That's awfully vague, google something like "uwp stream audio" to find relevant hits.

– Hans Passant
Dec 31 '18 at 22:06












2 Answers
2






active

oldest

votes


















0














You can't.



StorageFile.* is for directly accessing files in the in the UWP app's sandboxed file system; accessing files in known folders it has declared Capabilities for; or for making a copy of picked files not for downloading/streaming stuff fromt the Internet.



I quote:




StorageFile.GetFileFromPathAsync



Gets a StorageFile object to represent the file at the specified path.



ArgumentException`



The path cannot be a relative path or a Uri. Check the value of path.




...and




StorageFile.GetFileFromApplicationUriAsync



Gets a StorageFile object to represent the specified Uniform Resource Identifier (URI) app resource. For examples of sample URIs see Load images and assets tailored for scale, theme, high contrast, and others.



var uri = new Windows.Foundation.Uri("ms-appx:///datafile.xml") // <----- SEE
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done( /* Your success and error handlers */ );



You can use this method to access your app's resources using either "ms-appx://" or "ms-appdata://" Uniform Resource Identifier (URI).




OP:




But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)




That's a bit of a hint because Windows file system max path is about 255 characters hence why you are getting the error too. It's straight-out rejecting it before it even realises that it's not a path.






share|improve this answer































    -1














    I've found another solution.



    Unfortunately, StorageFile cannot be gotten from the web. But I can use two different players linked with one timeline controller. Here's more detailed solution: How to play video and audio from separate URLs in UWP app?






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53991684%2fhow-to-combine-audio-and-video-tracks-for-playback-or-get-storagefile-from-the-w%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      You can't.



      StorageFile.* is for directly accessing files in the in the UWP app's sandboxed file system; accessing files in known folders it has declared Capabilities for; or for making a copy of picked files not for downloading/streaming stuff fromt the Internet.



      I quote:




      StorageFile.GetFileFromPathAsync



      Gets a StorageFile object to represent the file at the specified path.



      ArgumentException`



      The path cannot be a relative path or a Uri. Check the value of path.




      ...and




      StorageFile.GetFileFromApplicationUriAsync



      Gets a StorageFile object to represent the specified Uniform Resource Identifier (URI) app resource. For examples of sample URIs see Load images and assets tailored for scale, theme, high contrast, and others.



      var uri = new Windows.Foundation.Uri("ms-appx:///datafile.xml") // <----- SEE
      Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done( /* Your success and error handlers */ );



      You can use this method to access your app's resources using either "ms-appx://" or "ms-appdata://" Uniform Resource Identifier (URI).




      OP:




      But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)




      That's a bit of a hint because Windows file system max path is about 255 characters hence why you are getting the error too. It's straight-out rejecting it before it even realises that it's not a path.






      share|improve this answer




























        0














        You can't.



        StorageFile.* is for directly accessing files in the in the UWP app's sandboxed file system; accessing files in known folders it has declared Capabilities for; or for making a copy of picked files not for downloading/streaming stuff fromt the Internet.



        I quote:




        StorageFile.GetFileFromPathAsync



        Gets a StorageFile object to represent the file at the specified path.



        ArgumentException`



        The path cannot be a relative path or a Uri. Check the value of path.




        ...and




        StorageFile.GetFileFromApplicationUriAsync



        Gets a StorageFile object to represent the specified Uniform Resource Identifier (URI) app resource. For examples of sample URIs see Load images and assets tailored for scale, theme, high contrast, and others.



        var uri = new Windows.Foundation.Uri("ms-appx:///datafile.xml") // <----- SEE
        Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done( /* Your success and error handlers */ );



        You can use this method to access your app's resources using either "ms-appx://" or "ms-appdata://" Uniform Resource Identifier (URI).




        OP:




        But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)




        That's a bit of a hint because Windows file system max path is about 255 characters hence why you are getting the error too. It's straight-out rejecting it before it even realises that it's not a path.






        share|improve this answer


























          0












          0








          0







          You can't.



          StorageFile.* is for directly accessing files in the in the UWP app's sandboxed file system; accessing files in known folders it has declared Capabilities for; or for making a copy of picked files not for downloading/streaming stuff fromt the Internet.



          I quote:




          StorageFile.GetFileFromPathAsync



          Gets a StorageFile object to represent the file at the specified path.



          ArgumentException`



          The path cannot be a relative path or a Uri. Check the value of path.




          ...and




          StorageFile.GetFileFromApplicationUriAsync



          Gets a StorageFile object to represent the specified Uniform Resource Identifier (URI) app resource. For examples of sample URIs see Load images and assets tailored for scale, theme, high contrast, and others.



          var uri = new Windows.Foundation.Uri("ms-appx:///datafile.xml") // <----- SEE
          Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done( /* Your success and error handlers */ );



          You can use this method to access your app's resources using either "ms-appx://" or "ms-appdata://" Uniform Resource Identifier (URI).




          OP:




          But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)




          That's a bit of a hint because Windows file system max path is about 255 characters hence why you are getting the error too. It's straight-out rejecting it before it even realises that it's not a path.






          share|improve this answer













          You can't.



          StorageFile.* is for directly accessing files in the in the UWP app's sandboxed file system; accessing files in known folders it has declared Capabilities for; or for making a copy of picked files not for downloading/streaming stuff fromt the Internet.



          I quote:




          StorageFile.GetFileFromPathAsync



          Gets a StorageFile object to represent the file at the specified path.



          ArgumentException`



          The path cannot be a relative path or a Uri. Check the value of path.




          ...and




          StorageFile.GetFileFromApplicationUriAsync



          Gets a StorageFile object to represent the specified Uniform Resource Identifier (URI) app resource. For examples of sample URIs see Load images and assets tailored for scale, theme, high contrast, and others.



          var uri = new Windows.Foundation.Uri("ms-appx:///datafile.xml") // <----- SEE
          Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done( /* Your success and error handlers */ );



          You can use this method to access your app's resources using either "ms-appx://" or "ms-appdata://" Uniform Resource Identifier (URI).




          OP:




          But I can't get StorageFile's because of PathTooLongException (url length is about 800 characters)




          That's a bit of a hint because Windows file system max path is about 255 characters hence why you are getting the error too. It's straight-out rejecting it before it even realises that it's not a path.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 at 0:43









          MickyDMickyD

          10.8k63354




          10.8k63354

























              -1














              I've found another solution.



              Unfortunately, StorageFile cannot be gotten from the web. But I can use two different players linked with one timeline controller. Here's more detailed solution: How to play video and audio from separate URLs in UWP app?






              share|improve this answer




























                -1














                I've found another solution.



                Unfortunately, StorageFile cannot be gotten from the web. But I can use two different players linked with one timeline controller. Here's more detailed solution: How to play video and audio from separate URLs in UWP app?






                share|improve this answer


























                  -1












                  -1








                  -1







                  I've found another solution.



                  Unfortunately, StorageFile cannot be gotten from the web. But I can use two different players linked with one timeline controller. Here's more detailed solution: How to play video and audio from separate URLs in UWP app?






                  share|improve this answer













                  I've found another solution.



                  Unfortunately, StorageFile cannot be gotten from the web. But I can use two different players linked with one timeline controller. Here's more detailed solution: How to play video and audio from separate URLs in UWP app?







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 1 at 19:11









                  XFoxXFox

                  296




                  296






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53991684%2fhow-to-combine-audio-and-video-tracks-for-playback-or-get-storagefile-from-the-w%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      'app-layout' is not a known element: how to share Component with different Modules

                      android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                      WPF add header to Image with URL pettitions [duplicate]