cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Sorg (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-7007) iOS Media Plugin: mp3 does not play
Date Mon, 23 Jun 2014 16:51:25 GMT

     [ https://issues.apache.org/jira/browse/CB-7007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Markus Sorg updated CB-7007:
----------------------------

    Description: 
Hello,

I have a file named 2.mp3 in the folder APP_DIR/Library/files/app-data/main-packages/en/.
My persistent file storage location is configured in config.xml ("Library" for iOS):

{code:borderStyle=solid}<preference name="AndroidPersistentFileLocation" value="Internal"
/>
<preference name="iosPersistentFileLocation" value="Library" />{code}

This code will play the file perfectly on Android but not on iOS:

{code:borderStyle=solid}
window.requestFileSystem(
    LocalFileSystem.PERSISTENT,
    0,
    function(fileSystem) {
        fileSystem.root.getDirectory('app-data/main-packages/en/', {create: false}, function(sourceDir){
            sourceDir.getFile('2.mp3', {create: false}, function(file){
                console.log('file url: ', file.toURL());
                var mymedia = new Media(file.toURL()); 
                mymedia.play();
            });
        });
    },
    function(err){
        console.log('Error in requestFilesystem, err.code', err.code);                   

    }
);
{code}

The console.log() in the getFile callback will output the following files:

{code:borderStyle=solid}
Simulator: file:///Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3

Device: 
file:///var/mobile/Applications/0C73C60B-07FD-486D-8927-7568D8BBBFD2/Library/files/app-data/main-packages/en/2.mp3
{code}

The files definitely exist at these locations, but I get the following error:

{code:borderStyle=solid}
2014-06-23 17:10:10.599 nnn[17439:60b] Unknown resource 'file:///Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3'
{code}

If I put the same file in the app documents folder and trigger the Media plugin with the following
code it will play:

{code:borderStyle=solid}
var myMedia = new Media('documents://2.mp3');
myMedia.play();
{code}

I also tried to call the Media Plugin with the "cdvfile"- Syntax. But it doesn't play either:

{code:borderStyle=solid}
var myMedia = new Media('cdvfile://Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3');
myMedia.play();
{code}

I'm running on the following Plugin versions:

{code:borderStyle=solid}
file: 1.1.0
media: 0.2.11
{code}

Any ideas ? 

Thanks in advance,
Markus

  was:
Hello,

I have a file named 2.mp3 in the folder APP_DIR/Library/files/app-data/main-packages/en/.
My persistent file storage location is configured in config.xml ("Library" for iOS):

{code:borderStyle=solid}<preference name="AndroidPersistentFileLocation" value="Internal"
/>
<preference name="iosPersistentFileLocation" value="Library" />{code}

This code will play the file perfectly on Android but not on iOS:

{code:borderStyle=solid}
window.requestFileSystem(
    LocalFileSystem.PERSISTENT,
    0,
    function(fileSystem) {
        fileSystem.root.getDirectory('app-data/main-packages/en/', {create: false}, function(sourceDir){
            sourceDir.getFile('2.mp3', {create: false}, function(file){
                console.log('file url: ', file.toURL());
                var mymedia = new Media(file.toURL()); 
                mymedia.play();
            });
        });
    },
    function(err){
        console.log('Error in requestFilesystem, err.code', err.code);                   

    }
);
{code}

The console.log() in the getFile callback will output the following files:

{code:borderStyle=solid}
Simulator: file:///Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3

Device: 
file:///var/mobile/Applications/0C73C60B-07FD-486D-8927-7568D8BBBFD2/Library/files/app-data/main-packages/en/2.mp3
{code}

The files definitely exist at these locations, but I get the following error:

{code:borderStyle=solid}
2014-06-23 17:10:10.599 nnn[17439:60b] Unknown resource 'file:///Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3'
{code}

If I put the same file in the app documents folder and trigger the Media plugin with the following
code it will play:

{code:borderStyle=solid}
var myMedia = new Media(documents://2.mp3);
myMedia.play();
{code}

I also tried to call the Media Plugin with the "cdvfile"- Syntax. But it doesn't play either:

{code:borderStyle=solid}
var myMedia = new Media('cdvfile://Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3');
myMedia.play();
{code}

I'm running on the following Plugin versions:

{code:borderStyle=solid}
file: 1.1.0
media: 0.2.11
{code}

Any ideas ? 

Thanks in advance,
Markus


> iOS Media Plugin: mp3 does not play
> -----------------------------------
>
>                 Key: CB-7007
>                 URL: https://issues.apache.org/jira/browse/CB-7007
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, Plugin File, Plugin Media
>    Affects Versions: 3.5.0
>            Reporter: Markus Sorg
>              Labels: media, mp3
>
> Hello,
> I have a file named 2.mp3 in the folder APP_DIR/Library/files/app-data/main-packages/en/.
My persistent file storage location is configured in config.xml ("Library" for iOS):
> {code:borderStyle=solid}<preference name="AndroidPersistentFileLocation" value="Internal"
/>
> <preference name="iosPersistentFileLocation" value="Library" />{code}
> This code will play the file perfectly on Android but not on iOS:
> {code:borderStyle=solid}
> window.requestFileSystem(
>     LocalFileSystem.PERSISTENT,
>     0,
>     function(fileSystem) {
>         fileSystem.root.getDirectory('app-data/main-packages/en/', {create: false}, function(sourceDir){
>             sourceDir.getFile('2.mp3', {create: false}, function(file){
>                 console.log('file url: ', file.toURL());
>                 var mymedia = new Media(file.toURL()); 
>                 mymedia.play();
>             });
>         });
>     },
>     function(err){
>         console.log('Error in requestFilesystem, err.code', err.code);              
     
>     }
> );
> {code}
> The console.log() in the getFile callback will output the following files:
> {code:borderStyle=solid}
> Simulator: file:///Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3
> Device: 
> file:///var/mobile/Applications/0C73C60B-07FD-486D-8927-7568D8BBBFD2/Library/files/app-data/main-packages/en/2.mp3
> {code}
> The files definitely exist at these locations, but I get the following error:
> {code:borderStyle=solid}
> 2014-06-23 17:10:10.599 nnn[17439:60b] Unknown resource 'file:///Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3'
> {code}
> If I put the same file in the app documents folder and trigger the Media plugin with
the following code it will play:
> {code:borderStyle=solid}
> var myMedia = new Media('documents://2.mp3');
> myMedia.play();
> {code}
> I also tried to call the Media Plugin with the "cdvfile"- Syntax. But it doesn't play
either:
> {code:borderStyle=solid}
> var myMedia = new Media('cdvfile://Users/myUserName/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/9CE5380D-2B6C-461D-8902-071EFE8A1E70/Library/files/app-data/main-packages/en/2.mp3');
> myMedia.play();
> {code}
> I'm running on the following Plugin versions:
> {code:borderStyle=solid}
> file: 1.1.0
> media: 0.2.11
> {code}
> Any ideas ? 
> Thanks in advance,
> Markus



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message