I am trying out f-in-box for a project and have been successful in the following:
1. Use FPC_AddOnLoadExternalResourceHandler with CoMarshalInterThreadInterfaceInStream to stream a FLV in a separate thread
2. Use FPCN_LOADEXTERNALRESOURCE to load and play a MP3 from a stream. This however holds up the app until the entire MP3 loads. This is where my problem lies.
What I need to be able to do is stream a MP3 in a separate thread just like the FLV. This is where Ihave been unsuccessful. I have tried to use the AddOnLoadExternalResourceHandler for MP3 files but it crashes the app. I have tried the code below inside LOADEXTERNALRESOURCE to setup a thread for the stream. But this aborts with E_ABORT when writing to the stream and the MediaPlayback component behaves as if no file is loaded.
...
case FPCN_LOADEXTERNALRESOURCE:
{
SFPCLoadExternalResource* pInfo = (SFPCLoadExternalResource*)lParam;
if (0 == lstrcmpi(pInfo->lpszRelativePath, "test.mp3"))
{
SFPCLoadExternalResource* pInfo = (SFPCLoadExternalResource*)lParam;
IStream* pStream = pInfo->lpStream;
IStream* pStreamForMarshalling;
CoMarshalInterThreadInterfaceInStream(IID_IStream, pStream, &pStreamForMarshalling);
DWORD dwThreadId;
HANDLE hThread = CreateThread(NULL, 0, &FlashContentProviderThread, (LPVOID)pStreamForMarshalling, 0, &dwThreadId);
CloseHandle(hThread);
}
....
Has anybody been able to stream a MP3 in a separate thread so that it doesnt block up the system till the entire file is streamed? Please advise!
cheers
ani