我正在尝试OpenTok(来自GitHub Basic-Video-Chat的示例) 并想要保存屏幕截图。 有人可以推荐我该怎么做吗?可能我应该以某种方式从订阅者视图中获取位图?
答案 0 :(得分:0)
这是我在React js中做的事情
if (
otCore.internalState &&
otCore.internalState.subscribers &&
otCore.internalState.subscribers.camera
) {
let streams = otCore.internalState.subscribers.camera;
let key = Object.keys(streams)[0];
let object = streams[key];
if (object) {
let imgData = object.getImgData();
let div = document.createElement("div");
div.style =
"display: flex;justify-content: center;flex-direction: column;justify-items: center;align-items: center; min-height: -webkit-fill-available;";
let img = document.createElement("img");
img.setAttribute("src", "data:image/png;base64," + imgData);
img.setAttribute("height", "60%");
img.setAttribute("width", "70%");
var imgWin = window.open("", "", "postwindow");
imgWin.document.write("<title>DstTok:Annotation</title>");
imgWin.document.write("<body style='background:#666666'></body>");
div.appendChild(img);
imgWin.document.body.appendChild(div);
}
}
}