Thanks for the response salvadore.
I’m not trying to compile an HTTPProvider, but a Module. I am building using the Plugin for Eclipse, and believe it is properly installed, as I have been using it for building Modules and HTTPProviders for a couple of months without any problems.
I know the stream is being properly transcoded, because the transcoded stream is being recorded.
I have tried using the built-in HTTPProvider, if I pass the wrong parameter to it, I see a log on the console warning me of the mistake, but when all the parameters are correct, it does not log anything.
This is what I have done on my code:
Created a new IMediaStreamActionNotify3 and registered it to the correct stream, and on the onPublish method of it, I set an interval of 5 seconds, that will call the grabFrame method after the interval is done.
The method is like this:
public void grabFrame(String streamName)
{
while(true)
{
IMediaStream stream = appInstance.getStreams().getStream(streamName);
if (stream == null)
{
global.log("No stream");
break;
}
LiveStreamTranscoder liveStreamTranscoder = (LiveStreamTranscoder)stream.getLiveStreamTranscoder("transcoder");
if (liveStreamTranscoder == null)
{
global.log("No liveStreamTranscoder");
break;
}
TranscoderStream transcodingStream = liveStreamTranscoder.getTranscodingStream();
if (transcodingStream == null)
{
global.log("No transcodingStream");
break;
}
TranscoderStreamSourceVideo sourceVideo = transcodingStream.getSource().getVideo();
if (sourceVideo == null)
{
global.log("No sourceVideo");
break;
}
global.log("Call grabFrame");
try
{
sourceVideo.grabFrame(new GrabResult(), 426, 240);
}
catch(Exception e)
{
e.printStackTrace();
}
break;
}
}
While the class is created just like the article posted:
class GrabResult implements ITranscoderFrameGrabResult
{
public void onGrabFrame(TranscoderNativeVideoFrame videoFrame)
{
System.out.println("onGrabFrame");
global.log();
BufferedImage image = TranscoderStreamUtils.nativeImageToBufferedImage(videoFrame);
if (image != null)
{
global.log("dimensions: " + image.getWidth() + "x" + image.getHeight());
String storageDir = appInstance.getStreamStoragePath();
File pngFile = new File(storageDir+"/thumbnail.png");
File jpgFile = new File(storageDir+"/thumbnail.jpg");
try
{
if (pngFile.exists())
pngFile.delete();
ImageIO.write(image, "png", pngFile);
global.log("Save image: "+pngFile);
}
catch(Exception e)
{
global.log("File write error: "+pngFile);
}
try
{
if (jpgFile.exists())
jpgFile.delete();
ImageIO.write(image, "jpg", jpgFile);
global.log("Save image: "+jpgFile);
}
catch(Exception e)
{
global.log("File write error: "+jpgFile);
}
}
}
}
Is there any other info needed?
Thanks,
Diogo.