Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Visitor
Posts: 1
Registered: ‎10-02-2013
My Device: BlackBerry Z10
My Carrier: O2

"No such file or directory" when using mmr_input_attach(...) to attach an MP3 file

[ Edited ]

This is my code:

 

char workingdir[PATH_MAX];
char audiofileurl[PATH_MAX];
int ret;
	
getcwd( workingdir, PATH_MAX );
sprintf( audiofileurl, "file://%s/data/cache/%s", workingdir, pFileName );

Assert( m_pMediaPlayerConnectionHandle == NULL );
m_pMediaPlayerConnectionHandle = mmr_connect( NULL );
Assert( m_pMediaPlayerConnectionHandle != NULL );

mode_t mode = S_IRUSR | S_IXUSR;
m_pMediaContext = mmr_context_create( m_pMediaPlayerConnectionHandle, "MyAudioStreamer", 0, mode );
Assert( m_pMediaContext != NULL );

const char* audiourl = "audio:default";
m_AudioOutputID = mmr_output_attach( m_pMediaContext, audiourl, "audio" );
Assert( m_AudioOutputID > -1 );

// put it in a list, so we can specify repeat below
ret = mmr_input_attach( m_pMediaContext, audiofileurl, "autolist" );
const mmr_error_info_t* err = mmr_error_info( m_pMediaContext );

 

mmr_input_attach is returning -1, and when I look at the error it says "No such file or directory".

The audiourl variable contains:

 

file:///accounts/1000/appdata/namespace.application/data/cache/music.mp3

 

(I'm not pasting the real namespace for legal reasons).

 

I've used the shell to navigate the directories on my device and confirmed that the MP3 file is definitely at that location.

 

EDIT: I've also confirmed the case-sensitivity of the string (since apparently everything is case sensitive in BlackBerry OS 10). I've also performed a chmod -R 777 on my entire /data/cache/ directory to ensure the app can access the file.

 

 

So is there something obvious which I'm missing?

 

 

I've noticed all the examples I've read store their music in /app/native/, whereas I'm storing it in /data/cache/, but I don't think that could cause the issue since the BlackBerry documentation states that the app has read/write access to /data/cache/

 

Thanks