Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-6106

File needs a method to get a webview-native URL from an Entry

    XMLWordPrintableJSON

Details

    Description

      I was really, really hoping to avoid having to include this in the API, but it appears that there are some WebView interfaces (specifically <video> and <audio> HTML tags) which cannot be made to work with cdvfile:// URLs.

      (See CB-6079 for the issue which triggered this revelation)

      I'm going to create a method (toNativeURL) on Entry objects, inherited by DirectoryEntry and FileEntry, which exposes a URL that can be used as a src attribute for an HTML5 media player.

      Usage:

      requestFileSystem(PERSISTENT, 0, function(fs) {
          fs.root.getFile("movie.mp4", {}, function(entry) {
              alert(entry.toNativeURL());
              document.getElementById('my-video-player').src=entry.toNativeURL();
          });
      });
      

      Developers will be able to use this in all cases where they need to set the src of an HTML audio/video tag, or in any other cases where the WebView doesn't correctly proxy URL requests through the app.

      Attachments

        Issue Links

          Activity

            People

              iclelland Ian Clelland
              iclelland Ian Clelland
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: