admin管理员组文章数量:1333389
I'd like to display a video from a stream;
I have a nodeJS server sending an ogg video stream to a websocket port, and when a client connects to that port, it starts receiving the video stream data, but the following method does not seem to understand the data as video correctly...
In the following context, "camera" is a html5 video tag id:
function connectWS()
{
var client = new BinaryClient('ws://192.168.161.193:8088');
client.on('stream', function(stream, meta)
{
stream.on('data', function(data)
{
var arrayBuffer = [];
arrayBuffer.push(data);
var video = new Blob([new Uint8Array(arrayBuffer)], { type: "video/ogg" });
document.getElementById('camera').src = (window.URL || window.webkitURL).createObjectURL(video);
});
});
}
Someone seems to already have the video blob working, but I can't find how...
Display a video from a Blob Javascript
Thank you!
I'd like to display a video from a stream;
I have a nodeJS server sending an ogg video stream to a websocket port, and when a client connects to that port, it starts receiving the video stream data, but the following method does not seem to understand the data as video correctly...
In the following context, "camera" is a html5 video tag id:
function connectWS()
{
var client = new BinaryClient('ws://192.168.161.193:8088');
client.on('stream', function(stream, meta)
{
stream.on('data', function(data)
{
var arrayBuffer = [];
arrayBuffer.push(data);
var video = new Blob([new Uint8Array(arrayBuffer)], { type: "video/ogg" });
document.getElementById('camera').src = (window.URL || window.webkitURL).createObjectURL(video);
});
});
}
Someone seems to already have the video blob working, but I can't find how...
Display a video from a Blob Javascript
Thank you!
Share Improve this question edited May 23, 2017 at 11:45 CommunityBot 11 silver badge asked Sep 3, 2013 at 12:38 SergioBRSergioBR 912 silver badges7 bronze badges1 Answer
Reset to default 4stream.ondata
is fired every time a new chunk of data is received.
You tried to create a new blob multiple times in stream.ondata
.
I think you may wanted to create a new blob only once in client.onstream
and push data into it multiple times.
本文标签: htmlVideo source from javascript blobStack Overflow
版权声明:本文标题:html - Video source from javascript blob - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742334363a2455327.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论