Hi Jules,
I tried playing a movie from a URL. But the quicktime component didn’t play it. This is my code.
void MoviePlayer::buttonClicked (juce::Button *button)
{
juce::URL url(urlString);
juce::InputStream * stream = url.createInputStream (true);
if (stream != 0L && _pQTComponent != 0L)
{
bool status = _pQTComponent->loadMovie (stream,true);
// status is false
if (status)
_pQTComponent->play ();
else
juce::Logger::outputDebugString(T("failed to load the movie"));
}
}
The Component is visible. It displays a blank screen.
I debugged into juce_mac_QuickTimeMovieComponent.mm.
static QTMovie* openMovieFromStream (InputStream* movieStream, File& movieFile)
{
// unfortunately, QTMovie objects can only be created on the main thread..
jassert (MessageManager::getInstance()->isThisTheMessageThread());
QTMovie* movie = 0;
FileInputStream* const fin = dynamic_cast <FileInputStream*> (movieStream);
if (fin != 0)
{
movieFile = fin->getFile();
movie = [QTMovie movieWithFile: juceStringToNS (movieFile.getFullPathName())
error: nil];
}
else
{
MemoryBlock temp;
movieStream->readIntoMemoryBlock (temp);
const char* const suffixesToTry[] = { ".mov", ".mp3", ".avi", ".m4a" };
for (int i = 0; i < numElementsInArray (suffixesToTry); ++i)
{
movie = [QTMovie movieWithDataReference: [QTDataReference dataReferenceWithReferenceToData: [NSData dataWithBytes: temp.getData()
length: temp.getSize()]
name: [NSString stringWithCString: suffixesToTry[i]]
MIMEType: @""]
error: nil];
// movie is null, so it doesn't play the video
if (movie != 0)
break;
}
}
return movie;
}
I am trying to play a mov file. I haven’t tested this on Windows, this is the result in SL.