Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,
I am using IMedia to play mp3 music file but it is not playing.
No error is return when i use IMedia_paly() .

Code

int nErr = 0;
AEEMediaData md;

if (pMe->pIMedia != NULL)
IMedia_Stop(pMe->pIMedia);

pMe->pszMediaFile = pTune;

nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_MEDIAMP3 , (void **)&pMe->pIMedia);
if (SUCCESS != nErr) {
pMe->pIMedia = NULL;
return FALSE;
}

// Set media data to use an .mp3 file in the app directory.
md.clsData = MMD_FILE_NAME; // pData will be media filename
md.pData = (void*)pMe->pszMediaFile; // Media filename
md.dwSize = 0;

nErr = IMedia_SetMediaData(pMe->pIMedia, &md);

if (SUCCESS != nErr) { // Set the media source
// Failed to set the source.
return FALSE;
}
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
if ((SUCCESS != nErr) && (MM_PENDING != nErr)) {
// Handle error condition
return FALSE;

nErr = IMedia_Play(pMe->pIMedia);
if(SUCCESS!= nErr){
return FALSE ;
}

Hi,
Please try the below code and let us know if you still see any issue.
int nErr = 0;
AEEMediaData md;
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_MEDIAMP3, (void**) &pMe->piIMediaobj);
md.clsData = MMD_FILE_NAME;
md.pData = (void*)"sample.mp3";
md.dwSize = 0;
nErr = IMedia_SetMediaData(pMe->piIMediaobj,&md);
nErr = IMedia_Play(pMe->piIMediaobj);
You need to copy the sample.mp3 file to your project folder. Hope this helps you. Kindly revert back if you still see the file is not playing.
Thanks,
Sreekanth Aila

Hi,
Please try the below code and let us know if you still see any issue.
int nErr = 0;
AEEMediaData md;
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_MEDIAMP3, (void**) &pMe->piIMediaobj);
md.clsData = MMD_FILE_NAME;
md.pData = (void*)"sample.mp3";
md.dwSize = 0;
nErr = IMedia_SetMediaData(pMe->piIMediaobj,&md);
nErr = IMedia_Play(pMe->piIMediaobj);
You need to copy the sample.mp3 file to your project folder. Hope this helps you. Kindly revert back if you still see the file is not playing.
Thanks,
Sreekanth Aila

Hi dear
Thanks,
Ya i have use code given by You.
But still i am not able to play mp3 file.
I was also use following code.
pIFile = IFILEMGR_OpenFile(pfm, pMe->pszMediaFile, _OFM_READ);
if (NULL == pIFile)
{
// Insert code to handle error condition
return FALSE;
}
This code return false , So problem in open file

Hi dear
Thanks,
Ya i have use code given by You.
But still i am not able to play mp3 file.
I was also use following code.
pIFile = IFILEMGR_OpenFile(pfm, pMe->pszMediaFile, _OFM_READ);
if (NULL == pIFile)
{
// Insert code to handle error condition
return FALSE;
}
This code return false , So problem in open file

Hi Kapasan,
Could you be more specific when you say that you are unable to play MP3 file, Please do the below steps and let us know
1) Have you tried playing the other music files from your application, I suspect it may be problem with the MP3 file that you are using, if you haven't tried yet could you please try with other music files (may be other MP3 file or MIDI file) and let us know.
2) Please add the below code in your sample application and let us know what is the sequence of events you see in the below callback function:
//Register a callback notification function with IMedia Interface object where
//asynchronous events are reported through this callback.
nErr = IMedia_RegisterNotify(pMe->piIMediaobj,(PFNMEDIANOTIFY)Notifier_Func1,(void*)pMe);
Add the above code after you set the Media data using IMedia_SetMediaData().
//Notification Function where asynchronous events are received:
void Notifier_Func1(void *lpMe,AEEMediaCmdNotify *cmd)
{
c_sampleapp * pMe = (c_sampleapp *)lpMe;
if( (cmd->nStatus) == MM_STATUS_DONE)
{
DBGPRINTF("Status Done !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_START)
{
DBGPRINTF("Status Start !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_DATA_IO_DELAY)
{
DBGPRINTF("Status IO Delay !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_ABORT)
{
DBGPRINTF("Status ABORT !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_MEDIA_SPEC)
{
DBGPRINTF("Status Media Specifications");
}
else if( (cmd->nStatus) == MM_STATUS_TICK_UPDATE)
{
DBGPRINTF("Status Playback Tick Update");
}
else
{
DBGPRINTF("Unknown Status %d",cmd->nStatus);
}

Thanks,
Sreekanth Aila

Hi Kapasan,
Could you be more specific when you say that you are unable to play MP3 file, Please do the below steps and let us know
1) Have you tried playing the other music files from your application, I suspect it may be problem with the MP3 file that you are using, if you haven't tried yet could you please try with other music files (may be other MP3 file or MIDI file) and let us know.
2) Please add the below code in your sample application and let us know what is the sequence of events you see in the below callback function:
//Register a callback notification function with IMedia Interface object where
//asynchronous events are reported through this callback.
nErr = IMedia_RegisterNotify(pMe->piIMediaobj,(PFNMEDIANOTIFY)Notifier_Func1,(void*)pMe);
Add the above code after you set the Media data using IMedia_SetMediaData().
//Notification Function where asynchronous events are received:
void Notifier_Func1(void *lpMe,AEEMediaCmdNotify *cmd)
{
c_sampleapp * pMe = (c_sampleapp *)lpMe;
if( (cmd->nStatus) == MM_STATUS_DONE)
{
DBGPRINTF("Status Done !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_START)
{
DBGPRINTF("Status Start !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_DATA_IO_DELAY)
{
DBGPRINTF("Status IO Delay !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_ABORT)
{
DBGPRINTF("Status ABORT !!!!");
}
else if( (cmd->nStatus) == MM_STATUS_MEDIA_SPEC)
{
DBGPRINTF("Status Media Specifications");
}
else if( (cmd->nStatus) == MM_STATUS_TICK_UPDATE)
{
DBGPRINTF("Status Playback Tick Update");
}
else
{
DBGPRINTF("Unknown Status %d",cmd->nStatus);
}

Thanks,
Sreekanth Aila

Hi Sreekanth
i have use this
nErr = IMedia_RegisterNotify(pMe->piIMediaobj,(PFNMEDIANOTIFY)Notifier_Func1,(void*)pMe);
then the out come is:
Status Done !!!!
Status Start !!!!
Status ABORT !!!!

Hi Sreekanth
i have use this
nErr = IMedia_RegisterNotify(pMe->piIMediaobj,(PFNMEDIANOTIFY)Notifier_Func1,(void*)pMe);
then the out come is:
Status Done !!!!
Status Start !!!!
Status ABORT !!!!

Hi,
Did you try playing the other music files from your application, if you haven't tried yet could you please try with other music files (may be other MP3 file or MIDI file, please try with the MP3 file provided at Brew MP SDK Installation DIR\tools\simulation\DataFiles\Sample.mp3) and let us know. Are you trying this on Simulator or on the device? if you are trying on Simulator could you tell us what version of Simulator you are using (For Example: Brew MP SDK 6.3 )?
Meanwhile we are trying to find the cause for the sequence of events that you are seeing in your application.
Thanks,
Sreekanth Aila

Hi,
Did you try playing the other music files from your application, if you haven't tried yet could you please try with other music files (may be other MP3 file or MIDI file, please try with the MP3 file provided at Brew MP SDK Installation DIR\tools\simulation\DataFiles\Sample.mp3) and let us know. Are you trying this on Simulator or on the device? if you are trying on Simulator could you tell us what version of Simulator you are using (For Example: Brew MP SDK 6.3 )?
Meanwhile we are trying to find the cause for the sequence of events that you are seeing in your application.
Thanks,
Sreekanth Aila

Hi Dear
I was use the Sample.mp3 music file provided in Brew MP SDK Installation.
and i am using Simulator ( Brew MP SDK Tool set 1.0 Rev 7.3) Brew MP 4.0
I have also set Privilege in cif file through Resource Manager.
But the problem is still there.
Thanks
Kapasan

Hi Dear
I was use the Sample.mp3 music file provided in Brew MP SDK Installation.
and i am using Simulator ( Brew MP SDK Tool set 1.0 Rev 7.3) Brew MP 4.0
I have also set Privilege in cif file through Resource Manager.
But the problem is still there.
Thanks
Kapasan

Hi,
Is the MP3 file that is being used in your application is present in the application directory itself? I mean have you copied it into the application directory, as you said that the File Open fails (IFILEMGR_OpenFile), I suspect that it is not able to find the file.
Thanks,
Sreekanth Aila

Hi,
Is the MP3 file that is being used in your application is present in the application directory itself? I mean have you copied it into the application directory, as you said that the File Open fails (IFILEMGR_OpenFile), I suspect that it is not able to find the file.
Thanks,
Sreekanth Aila

Hi
Yes file is in application directory.
Privousaly when i try to check that Is File is open in Read mode with the help of IFILEMGR_OpenFile() it return FALSE.
But that time i am not using this one
{
int nErr = 0;
AEEMediaData md;
pMe->pszMediaFile = "Sample.MP3";
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_MEDIAMP3 , (void **)&pMe->pIMedia);
if (SUCCESS != nErr) {
pMe->pIMedia = NULL;
return FALSE;
}
// Set media data to use an .mp3 file in the app directory.
md.clsData = MMD_FILE_NAME; // pData will be media filename
md.pData = (void *)pMe->pszMediaFile; // Media filename
md.dwSize = 0;
nErr = IMedia_SetMediaData(pMe->pIMedia, &md);
if (SUCCESS != nErr) { // Set the media source
// Failed to set the source.
return FALSE;
}
nErr = IMedia_RegisterNotify(pMe->pIMedia,(PFNMEDIANOTIFY)Notifier_Func1,(void*)pMe);
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
if ((SUCCESS != nErr) && (MM_PENDING != nErr)) {
// Handle error condition
return FALSE;
}
return TRUE;

///========================
after this setup i am calling
IMedia_play()
Thaks
Kapasan

Hi
Yes file is in application directory.
Privousaly when i try to check that Is File is open in Read mode with the help of IFILEMGR_OpenFile() it return FALSE.
But that time i am not using this one
{
int nErr = 0;
AEEMediaData md;
pMe->pszMediaFile = "Sample.MP3";
nErr = ISHELL_CreateInstance(pMe->piShell, AEECLSID_MEDIAMP3 , (void **)&pMe->pIMedia);
if (SUCCESS != nErr) {
pMe->pIMedia = NULL;
return FALSE;
}
// Set media data to use an .mp3 file in the app directory.
md.clsData = MMD_FILE_NAME; // pData will be media filename
md.pData = (void *)pMe->pszMediaFile; // Media filename
md.dwSize = 0;
nErr = IMedia_SetMediaData(pMe->pIMedia, &md);
if (SUCCESS != nErr) { // Set the media source
// Failed to set the source.
return FALSE;
}
nErr = IMedia_RegisterNotify(pMe->pIMedia,(PFNMEDIANOTIFY)Notifier_Func1,(void*)pMe);
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
if ((SUCCESS != nErr) && (MM_PENDING != nErr)) {
// Handle error condition
return FALSE;
}
return TRUE;

///========================
after this setup i am calling
IMedia_play()
Thaks
Kapasan

Hi Kapasan,
For a quick check can you try with below things:
1) Change
md.pData = (void *)pMe->pszMediaFile; // Media filename
TO
md.pData = (void *)"Sample.mp3";
2) Remove the below statements:
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
and see if it works. Mean while I will try to check the same with Brew MP Multimedia experts.
Thanks,
Sreekanth Aila

Hi Kapasan,
For a quick check can you try with below things:
1) Change
md.pData = (void *)pMe->pszMediaFile; // Media filename
TO
md.pData = (void *)"Sample.mp3";
2) Remove the below statements:
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
and see if it works. Mean while I will try to check the same with Brew MP Multimedia experts.
Thanks,
Sreekanth Aila

Hi Dear
After replacing
md.pData = (void *)pMe->pszMediaFile; // Media filename
TO
md.pData = (void *)"Sample.mp3";
and
removing
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
problem is still same.
Thanks,
Kapasan

Hi Dear
After replacing
md.pData = (void *)pMe->pszMediaFile; // Media filename
TO
md.pData = (void *)"Sample.mp3";
and
removing
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
problem is still same.
Thanks,
Kapasan

Hi,
Could you please try the following and let us know:
In the Visual Studio environment Goto Project menu and select Brew MP Properties, Now click on the package tab and try to add your music file (by adding a new package in which all the source files and this music file is also there) and then try build your app, run the app and let us know if you see any change.
Thanks,
Sreekanth Aila

Hi,
Could you please try the following and let us know:
In the Visual Studio environment Goto Project menu and select Brew MP Properties, Now click on the package tab and try to add your music file (by adding a new package in which all the source files and this music file is also there) and then try build your app, run the app and let us know if you see any change.
Thanks,
Sreekanth Aila

Hi Shreekant
I have made changes in Brew MP Properties and add music file in package .
then build and run. But after using above steps the problem is still same .
Thanks
Kapasan

Hi Shreekant
I have made changes in Brew MP Properties and add music file in package .
then build and run. But after using above steps the problem is still same .
Thanks
Kapasan

Is there case sensitivity issue here?
Sometimes I see you list the file as "Sample.mp3" and
other times as "sample.mp3".
Assume you tried playing sample.mp3 in another player in case the
file somehow got corrupted?
Kapasan wrote:Hi Dear
After replacing
md.pData = (void *)pMe->pszMediaFile; // Media filename
TO
md.pData = (void *)"Sample.mp3";
and
removing
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
problem is still same.
Thanks,
Kapasan

Is there case sensitivity issue here?
Sometimes I see you list the file as "Sample.mp3" and
other times as "sample.mp3".
Assume you tried playing sample.mp3 in another player in case the
file somehow got corrupted?
Kapasan wrote:Hi Dear
After replacing
md.pData = (void *)pMe->pszMediaFile; // Media filename
TO
md.pData = (void *)"Sample.mp3";
and
removing
pMe->uvolume = 25;
nErr = IMedia_SetVolume(pMe->pIMedia, pMe->uvolume);
problem is still same.
Thanks,
Kapasan

Hi,
Did you try the sample code present at
https://brewmobileplatform.qualcomm.com/devnet/docviewer.jsp?method=show...
and executed on your machine, if yes what do you see the output of the sample application?
Thanks,
Sreekanth Aila

Hi,
Did you try the sample code present at
https://brewmobileplatform.qualcomm.com/devnet/docviewer.jsp?method=show...
and executed on your machine, if yes what do you see the output of the sample application?
Thanks,
Sreekanth Aila