You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
967 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>H.264 Streaming</title>
<script src="{{ url_for('main.static', filename='scripts/flv.min.js') }}"></script>
<script src="{{ url_for('main.static', filename='scripts/jquery-3.2.1.min.js') }}"></script>
</head>
<body>
<video id="videoElement" controls autoplay width="640" height="480"></video>
<script>
if (flvjs.isSupported()) {
const videoElement = document.getElementById('videoElement');
const flvPlayer = flvjs.createPlayer({
type: 'flv',
isLive: true,
url: `ws://${window.location.host}/api/ws/video_feed/2` // 与 WebSocket 后端的 URL
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
flvPlayer.play();
}
</script>
</body>
</html>