palying_visit.jsp
7.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!doctype html>
<html>
<head>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path ;
String devicetype = (String) request.getAttribute("devicetype");
if(devicetype == null)
devicetype="android";
%>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" name="viewport" />
<meta name='apple-itunes-app' content='app-id=1141232775'>
<title>蜜家直播</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">
<link href="css/fbh.css" rel="stylesheet" type="text/css">
<link href="<%=basePath%>/css/video-js.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=basePath%>/js/jquery-1.9.1.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/emoji/emoji.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/jwplayer.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/jwpsrv.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/jwpsrv_frq.js"></script>
<script type="text/javascript">jwplayer.key="lsUqQ+PB1edH+bYoMb85Yr5CuPlXyhK/ngcyNQ==";</script>
</head>
<body>
<div class="container">
<div class="top">
<div class="playing-people">
<!--img src="${user.avatar}" class="img-responsive" id="people" /-->
<div id="playing-bottom">
<img src="img/logo.png" width="45" height="45" class="pull-left" />
<span class="top-title">蜜家直播</span>
<div class="download pull-right">
<a href="<%=basePath%>/assets/download.html">立即下载</a>
</div>
</div>
<%
if(devicetype.equals("pc")){
%>
<div id='container'></div>
<%}else{%>
<div id="container">
<video autoplay="false" width="100%" height="100%" preload="auto" poster="${live.thumbnail}">
<source type="video/mp4" src="${m3u8Addr}" />
</video>
</div>
<%} %>
</div>
<div class="zhubomess">
<div class="title">
<img src="${user.avatar}" width="50" height="50" />
<div class="message">
<div>
<span class="name pull-left" id="username">${user.emoName}</span>
<img src="img/${user.sex == 'female'?user.sex:'male'}.png" class="icon pull-left" />
<span class="glyphicon glyphicon-star-empty pull-left"><span style="padding-left: 3px;">${user.level}</span></span>
<div class="clear"></div>
</div>
<div class="mijia">蜜家号:${user.id}</div>
</div>
<a href="#" class="follow">+关注</a>
<div class="clear"></div>
</div>
</div>
<div class="guankan">观看直播 ${live.audienceTotalNum}人</div>
</div>
</div>
<script>
$(document).ready(function() {
var imgHeight = $("#people").height();
var docHeight=$(document.body).height();
//console.log(docHeight);
//console.log(imgHeight);
if(imgHeight<=0)
imgHeight=460;
$("#people").css("height",imgHeight);
$("#container_wrapper").css("top",50);
$("#container").css("height",imgHeight);
$("#container").css("width","100%");
$("#playing-bottom").css("top",imgHeight+75);
//$("#playing-bottom").css("top",docHeight-imgHeight-373);
});
//页面需要显示unicode编码的字符,可以后台或前端进行转换,数据库保存的是utf8mb4编码,读出来后,需要转换一次
$('#username').emoji();
</script>
<script>
//播放设置
var player = null;
function getWidth(){
var wWidth= $("#people").width();
if(wWidth<=0)
wWidth="100%";
$("#container_wrapper").css("width","100%");
return wWidth;
};
function getHeight() {
var wHeight = $("#people").height();
if(wHeight<=0)
wHeight=640;
$("#container_wrapper").css("height",wHeight);
$("#playing-bottom").css("top",wHeight+75);
return wHeight;
};
function play() {
player = jwplayer("container").setup({
flashplayer: '<%=request.getContextPath()%>/js/jwplayer.flash.swf',
id: 'playerID',
width: getWidth(),
height: getHeight(),
file: '${live.videoAddr}',
image: '${live.thumbnail}',
primary: "flash",
controls: true,
type:"rtmp",
events: {
onComplete: onComplete,
onReady: function () {
$('#play-control').show();
$('#media_status_msg').html('直播中,点击观看');
set_pos();
},
onPlay: onPlay,
onPause: onPause,
onBuffer: onBuffer,
onDisplayClick: onDisplayClick,
onSetupError: onSetupError,
onBufferChange: function () { console.log("onBufferChange!!!"); },
onBufferFull: function () { console.log("onBufferFull!!!"); }
},
players:
[
{ type: "html5"},
{ type: "flash", src: '<%=request.getContextPath()%>/js/jwplayer.flash.swf' }
]
});
}
function onComplete() {
//alert('播放完毕');
}
function onBuffer() {
$('#media_status_msg').hide();
$('#play-control').show();
$('#play-control').attr('class', 'btn loading pa');
console.log('onBuffer');
}
function onPlay() {
$('#media_status_msg').hide();
$('#play-control').hide();
$('#play-control').attr('class', 'btn play pa');
}
function onPause() {
$('#media_status_msg').hide();
$('#play-control').show();
$('#play-control').attr('class', 'btn play pa');
playing = false;
console.log('onPause');
}
function onDisplayClick() {
player.pause();
}
function onSetupError(a, b) {
}
function user_show() {
if (trim($('#nick').html()) == '') {
$('.user').hide();
}else{
$('.user').show();
}
}
function set_pos() {
var play_left = $('#container_wrapper').offset().left;
}
function resize() {
set_pos();
}
var playing = false;
$(document).ready(function(){
<%
if(devicetype.equals("pc")){
%>
play();
$('#play-control').click(function() {
player.play();
$('#play-control').show();
});
<%} %>
});
</script>
<script type="text/javascript">
// To avoid the "protocol not supported" alert, fail must open another app.
var appstore = "https://itunes.apple.com/cn/app/facebook/id284882215?mt=8"
function applink(fail){
return function(){
var clickedAt = +new Date;
// During tests on 3g/3gs this timeout fires immediately if less than 500ms.
setTimeout(function(){
// To avoid failing on return to MobileSafari, ensure freshness!
if (+new Date - clickedAt < 2000){
window.location = fail;
}
}, 500);
};
}
document.getElementById("applink1").onclick = applink(appstore);
document.getElementById("applink2").onclick = applink(appstore);
</script>
</body>
</html>