<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>直播观看界面</title>
<style type="text/css">
body {
}
.video {
width: 600px;
background: rgba(247, 180, 180, 0.1);
box-shadow: 0px 0px 11px #666;
margin: 20px auto;
text-align: center;
}
/*标题样式*/
h1 {
color: #FF9800;
text-shadow: 1px 1px 2px #000;
font-family: "华文彩云";
}
/*消息发送区域样式*/
.msg {
margin: 0 auto;
width: 600px;
height: 200px;
text-align: center;
box-shadow: 0px 0px 11px 0px #000;
}
/*消息显示区域样式*/
.content {
height: 170px;
overflow: auto;
text-align: left;
color: blue;
}
/*消息输入框样式*/
input {
height: 28px;
width: 99%;
background: rgba(0, 0, 0, 0.12);
border: 1px solid #fff;
border-radius: 3px;
color: #FFEB3B;
margin-bottom: 45px;
}
.video,.msg {
border-radius: 10px;
}
img {
border-radius: 5px;
margin-bottom: 8px;
}
/*消息显示 区域*/
#content {
background: rgba(0, 0, 100, 0.12);
color: white;
padding-left: 10px;
}
/*消息发送区域*/
#sendMsg {
padding-left: 10px;
color: black;
}
</style>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<!--
作者:秦伟
时间:2018-07-23
描述:直播视频区域
-->
<div class="video">
<h1>欢迎使用"wǒ乄冭嘽純"直播系统</h1>
<img id="receiver" style="width: 400px;height: 300px;" />
</div>
<!--
作者:秦伟
时间:2018-07-23
描述:观众聊天评论区域
-->
<div class="msg">
<div class="content" id="content"></div>
<input type="text" name="sendMsg" id="sendMsg" value="" />
</div>
<script type="text/javascript" charset="UTF-8">
function $(id) {
return document.getElementById(id);
}
//第一步:连接服务器的WebSocket(建立连接包括视频,聊天服务)
//聊天服务
var chatSocket = new WebSocket(
"ws://localhost:8080/ZHUbozhibo/chatroom");
//视频服务
var videoSocket = new WebSocket("ws://localhost:8080/ZHUbozhibo/video");
//功能一: 将接受到的视频图片展示在img控件内
//获取图片控件
var img = $("receiver");
//当它有消息时要处理
videoSocket.onmessage = function(msg) {
img.src = msg.data;
}
//功能二: 将接受到的聊天消息,追加到消息显示区域
chatSocket.onmessage = function(msg) {
var content = $("content");
//追加
content.innerHTML += "<br>" + msg.data;
//滚动条 滚动到顶部
content.scrollTop = content.scrollHeight;
}
//获取消息发送控件
//监听鼠标事件
window.onkeydown = function(event) {
//如果按了回车键就触发
if (event.keyCode == 13) {
var msgs = $("sendMsg");
//获取到输入框的值
chatSocket.send(msgs.value);
//清空该控件
msgs.value = "";
}
}
</script>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
java实现简单直播系统
共66个文件
java:9个
class:9个
png:7个
3星 · 超过75%的资源 需积分: 45 229 下载量 186 浏览量
2018-10-19
11:44:51
上传
评论 28
收藏 1.69MB RAR 举报
温馨提示
java实现直播系统,有主播界面,围观界面,可以相互切换,登录权限
资源推荐
资源详情
资源评论
收起资源包目录
直播系统.rar (66个子文件)
直播系统
直播系统记事本版
viddeoServer.txt 1KB
观看界面.txt 3KB
ChatRoom.txt 1KB
主播界面.txt 3KB
直播.sql 1KB
InternalLive
resourse
database.properties 142B
fonlg.xml 983B
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
org.eclipse.wst.jsdt.ui.superType.name 6B
com.genuitec.eclipse.core.prefs 105B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.core.resources.prefs 101B
org.eclipse.wst.common.component 552B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 500B
org.eclipse.jdt.core.prefs 395B
src
com
live
biz
Userbiz.java 719B
servet
ChatRoom.java 1KB
VideoServer.java 1KB
CaptchaServlet.java 2KB
userServlet.java 4KB
bizimps
Userbizimps.java 2KB
util
Util.java 1019B
usermapperdao
UserMapper.java 726B
UserMapper.xml 884B
entit
User.java 630B
.project 2KB
WebRoot
css
sms.css 2KB
style.css 3KB
jsbar
jquery-1.12.4.js 297KB
images
sms_btn_reset.png 3KB
login_bg.jpg 45KB
sms_input_bg.gif 993B
sms_btn_login.png 3KB
sms_reg_title.png 6KB
formBg.png 41KB
sms_btn_goback.png 4KB
sms_reg_bg.png 16KB
zhucejiemian.jpg 44KB
sms_btn_reg.png 3KB
loginBg.jpg 18KB
META-INF
MANIFEST.MF 36B
loger.jsp 2KB
WEB-INF
web.xml 1KB
classes
database.properties 142B
com
live
biz
Userbiz.class 514B
servet
userServlet.class 5KB
ChatRoom.class 2KB
CaptchaServlet.class 3KB
VideoServer.class 2KB
bizimps
Userbizimps.class 2KB
util
Util.class 2KB
usermapperdao
UserMapper.class 530B
UserMapper.xml 884B
entit
User.class 908B
fonlg.xml 983B
lib
mysql-connector-java-5.0.8-bin.jar 528KB
websocket-api.jar 36KB
fastjson-1.2.13.jar 384KB
mybatis-3.1.1.jar 636KB
registered.jsp 3KB
display.jsp 5KB
index.jsp 3KB
watch.jsp 4KB
.mymetadata 309B
.classpath 576B
.myeclipse
共 66 条
- 1
资源评论
- yann.bai2021-03-25大佬,你这个主页路径是啥啊
- 若水似水2022-07-15大哥,你这个优点夸张了,41个积分,结果就一个jsp selvlet用户登录?惨不忍睹
码农Movinbricks
- 粉丝: 120
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功