我在将图像叠加层显示在回送视频上时遇到麻烦。我可以使用rtpEndpoint.connect(rtpEndpoint, function....)
对脚本进行环回,但是当我尝试添加ImageOverlayFilter时,出现了一些我无法解决的错误。
错误:“ MediaType”的值无效
“错误”:{“代码”:40001,“数据”:{“类型”:“ MARSHALL_ERROR”},“消息”:“'MediaType'的值无效”}
var overlayparams = {
id: "TESTTEST",
uri: "file://tmp/media/sample.png",
offsetXPercent: 0,
offsetYPercent: 0,
widthPercent: 0,
heightPercent: 0,
keepAspectRatio: true,
center: true,
mediaPipeline: pipeline
}
pipeline.create("ImageOverlayFilter", overlayparams, function (error, filter) {
if (error) return console.log(">>>>>"+ error);
return callback(null, rtpEndpoint, filter);
});
文件后面
rtpEndpoint.connect(rtpEndpoint, imageOverlay, rtpEndpoint, function (error) {
if (error) return onError(error);
console.log("Added overlay to loopback");
});
/*
// This works for normal loopback
rtpEndpoint.connect(rtpEndpoint, function (error) {
if (error) return onError(error);
console.log("loopback works");
});
*/
我也尝试过使用filter.addVideo方法而不是overlayparams对象,但是它会产生相同的结果。
[假设imageoverlayfilter类似于Kurento中的faceoverlayfilter,所引用的文件必须为http网址。如果您将文件存储在本地,则需要使用Web服务器将其存储或远程托管。
所以,而不是...“ file://tmp/media/sample.png”
取决于您在哪里拥有http(s)服务器的根目录,您将拥有...“ https://localhost/tmp/media/sample.png”
还请注意,在kurento 6.11之前,已确认imageoverlay过滤器存在问题。最新的是6.13,所以可以解决...https://github.com/Kurento/bugtracker/issues/350