Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flvjs 如何 将websocket 返回的数据渲染出来 ? player.appendBuffer(data); 实例上没有appendBuffer 方法了? #789

Open
yz-yz-yz opened this issue May 8, 2023 · 0 comments

Comments

@yz-yz-yz
Copy link

yz-yz-yz commented May 8, 2023

var player = flvjs.createPlayer({
type: "flv",
isLive: true, // 是否为实时直播流
hasAudio: false, // 是否有音频轨道
hasVideo: true, // 是否有视频轨道
duration: 0, // 视频时长,如果是直播流则设置为 0
url: null, // 媒体数据源地址,设置为 null,使用下面的方法传入数据流
});
player.attachMediaElement(videoElement);
// load player
player.load();
// start playing
player.play();
var ws = new WebSocket("ws://localhost:8080");
ws.onmessage = (e) => {
var data = new Uint8Array(e.data);
player.appendBuffer(data);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant