You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Ashley Gullen (Created) (JIRA)" <ji...@apache.org> on 2012/02/29 15:01:57 UTC

[jira] [Created] (CB-285) Add property returning root path of PhoneGap files

Add property returning root path of PhoneGap files
--------------------------------------------------

                 Key: CB-285
                 URL: https://issues.apache.org/jira/browse/CB-285
             Project: Apache Callback
          Issue Type: Improvement
          Components: CordovaJS
    Affects Versions: 1.4.0
         Environment: Both PhoneGap SDK and PhoneGap Build
            Reporter: Ashley Gullen
            Priority: Blocker


There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:

/android_asset/www/music.mp3

On iOS after being built with PhoneGap Build it will be located in some path like this:

/var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3

However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.

This has two side effects:
1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.

This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CB-285) Add property returning root path of PhoneGap files

Posted by "Filip Maj (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219342#comment-13219342 ] 

Filip Maj edited comment on CB-285 at 2/29/12 5:00 PM:
-------------------------------------------------------

I agree this is an important feature, but I think we need to carefully frame the problem.

What exactly do you mean by "root"? Root of the application location, or root of the device file system? Why exactly do you need the "root" location? My point is, are you simply looking for a permanent / persistent location on the device to write and read files from, for use with your app? If so, then we have an existing method ([window.requestFileSystem and the LocalFileSystem|http://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#LocalFileSystem]) that can get you both a temporary and a persistent file system location independent of your device. 

The trickiness with asking for "root" is the differing security constraints across all of the Cordova platforms.

My opinion is, if you are looking for a "safe" location to read and write files to in a cross-platform way, I would use the requestFileSystem method and work from there. If there are issues with using this method, then we should figure those out, instead of adding a new property somewhere to the Cordova API.

Actually this issue coincidentally is timed very well as we are just starting a discussion about what, if any, abstraction over file system URIs are needed in Cordova. The discussion starts [here|http://mail-archives.apache.org/mod_mbox/incubator-callback-dev/201202.mbox/%3CCADjNb+nsrJ2V-SfptWrHUAdsTsRKnbdFCLO-NijW-LwqPLd6zA@mail.gmail.com%3E] - feel free to chime in.
                
      was (Author: filmaj):
    I agree this is an important feature, but I think we need to carefully frame the problem.

What exactly do you mean by "root"? Root of the application location, or root of the device file system? Why exactly do you need the "root" location? My point is, are you simply looking for a permanent / persistent location on the device to write and read files from, for use with your app? If so, then we have an existing method ([window.requestFileSystem and the LocalFileSystemhttp://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#LocalFileSystem]) that can get you both a temporary and a persistent file system location independent of your device. 

The trickiness with asking for "root" is the differing security constraints across all of the Cordova platforms.

My opinion is, if you are looking for a "safe" location to read and write files to in a cross-platform way, I would use the requestFileSystem method and work from there. If there are issues with using this method, then we should figure those out, instead of adding a new property somewhere to the Cordova API.

Actually this issue coincidentally is timed very well as we are just starting a discussion about what, if any, abstraction over file system URIs are needed in Cordova. The discussion starts [here|http://mail-archives.apache.org/mod_mbox/incubator-callback-dev/201202.mbox/%3CCADjNb+nsrJ2V-SfptWrHUAdsTsRKnbdFCLO-NijW-LwqPLd6zA@mail.gmail.com%3E] - feel free to chime in.
                  
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Randy McMillan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220174#comment-13220174 ] 

Randy McMillan commented on CB-285:
-----------------------------------

var root = window.location.href.slice(0,(window.location.href.length-11));  ///the - 11 subtracts /index.html from string

Ive tried to work around this issue for awhile and never found a practical solution. 

One goal would be able to pass local URLs to the ChildBrowser. Once this is possible the ChildBrowser could be used/modified to do some interesting things with local media. 
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Amirudin Bin Mohamed Ghani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219917#comment-13219917 ] 

Amirudin Bin Mohamed Ghani commented on CB-285:
-----------------------------------------------

Hey Fil, all

We have a good point here. That will be great to have a cross-platform reference for fullPath as it will help tremendously for variety of file operation / resource manipulation tasks. 
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Ashley Gullen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221032#comment-13221032 ] 

Ashley Gullen commented on CB-285:
----------------------------------

You're right, actually this can be worked around by parsing location.href.

IMO it's still worth adding a feature for this though - it seems odd that you'd have to do string parsing before you can play audio, and it would remove the opportunity for the string parsing to be done wrong (since it can be tricky to test on all possible PhoneGap platforms).
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Joe Bowser (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219476#comment-13219476 ] 

Joe Bowser commented on CB-285:
-------------------------------

If you bundle an MP3 in the android_asset, you're not going to be able to play it regardless.  You have to copy the asset out into the file system somewhere before you can access it.  I agree with Fil about looking for a safe, cross-platform way of accessing this.
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Patrick Mueller (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219594#comment-13219594 ] 

Patrick Mueller commented on CB-285:
------------------------------------

Does "location.href" not work for you?

on my iPad, from a PG app, I just tried:

{noformat}
console.log("location.href: " + location.href);
{noformat}

and the following was logged to the console

{noformat}
2012-02-29 17:05:25.456 PgSample[34564:707] [INFO] (continued next line)
location.href: file:///var/mobile/Applications/5148B1CE-EA87-4364-BD80-C01E38ED0F66/PgSample.app/www/index.html
{noformat}

or maybe this isn't a real location or isn't appropriate for your needs?

                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Ashley Gullen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219447#comment-13219447 ] 

Ashley Gullen commented on CB-285:
----------------------------------

No, this isn't for writing files at all.  Basically, if I bundle an MP3 next to the index.html file, it's impossible to programmatically determine the path to the MP3 file to pass to PhoneGap's Media object.  So it's impossible to programmatically play the MP3 file.  That's what I need it for!
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CB-285) Add property returning root path of PhoneGap files

Posted by "Filip Maj (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filip Maj updated CB-285:
-------------------------

    Priority: Major  (was: Blocker)

I agree this is an important feature, but I think we need to carefully frame the problem.

What exactly do you mean by "root"? Root of the application location, or root of the device file system? Why exactly do you need the "root" location? My point is, are you simply looking for a permanent / persistent location on the device to write and read files from, for use with your app? If so, then we have an existing method ([window.requestFileSystem and the LocalFileSystemhttp://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#LocalFileSystem]) that can get you both a temporary and a persistent file system location independent of your device. 

The trickiness with asking for "root" is the differing security constraints across all of the Cordova platforms.

My opinion is, if you are looking for a "safe" location to read and write files to in a cross-platform way, I would use the requestFileSystem method and work from there. If there are issues with using this method, then we should figure those out, instead of adding a new property somewhere to the Cordova API.

Actually this issue coincidentally is timed very well as we are just starting a discussion about what, if any, abstraction over file system URIs are needed in Cordova. The discussion starts [here|http://mail-archives.apache.org/mod_mbox/incubator-callback-dev/201202.mbox/%3CCADjNb+nsrJ2V-SfptWrHUAdsTsRKnbdFCLO-NijW-LwqPLd6zA@mail.gmail.com%3E] - feel free to chime in.
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Joe Bowser (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219502#comment-13219502 ] 

Joe Bowser commented on CB-285:
-------------------------------

Right (I had to check to make sure that this was the case, since it seems wrong) but that's only on Android, and that's because we add a level of abstraction to get access to the Android assets.  So instead of the user unzipping the MP3, we do it for them.  This sounds like it's an argument for abstracting the filesystem, since this is an abstraction of what is essentially the inside of an APK. 
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Ashley Gullen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219586#comment-13219586 ] 

Ashley Gullen commented on CB-285:
----------------------------------

Why abstract it on Android but not iOS?  Sounds like exactly the feature I need.  If you can't get the path to a media file in the same directory as the app, how are you meant to play pre-packaged audio files?
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CB-285) Add property returning root path of PhoneGap files

Posted by "Ashley Gullen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashley Gullen updated CB-285:
-----------------------------

    Description: 
There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:

/android_asset/www/music.mp3

On iOS after being built with PhoneGap Build it will be located in some path like this:

/var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3

However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.

This has two side effects:
1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.

This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.

This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

  was:
There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:

/android_asset/www/music.mp3

On iOS after being built with PhoneGap Build it will be located in some path like this:

/var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3

However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.

This has two side effects:
1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.

This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.

    
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>            Priority: Blocker
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Simon MacDonald (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219491#comment-13219491 ] 

Simon MacDonald commented on CB-285:
------------------------------------

That's not 100% true. At least on Android you can do:

    myMedia = new Media("/android_asset/www/test.mp3");

and be able to play the file.
                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-285) Add property returning root path of PhoneGap files

Posted by "Filip Maj (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219610#comment-13219610 ] 

Filip Maj commented on CB-285:
------------------------------

Pat, I think the core issue here is that these methods, like using location.href, are all platform-specific. It may work on iOS but what about Android?

To be clear, the core question we want to answer is: how can I reference an in-app-package file in a cross-platform way?


                
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              Labels: features
>
> There needs to be a property in PhoneGap that returns the root path to the general files added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add 'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID> and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform, which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.  Since a framework does not know the App ID or name in advance, it's impossible for the framework to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by Construct 2 (www.scirra.com), a HTML5 game creator.  Also, it seems like kind of an important function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira