Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2013-12-20 00:26:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5bfb561f893c61e0c46c442641a741fdd2265858
5bfb561f
1 parent
40c12984
add srs player
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
28 行增加
和
19 行删除
trunk/research/players/jwplayer6.html
trunk/research/players/srs_player.html
trunk/research/players/srs_player/release/srs_player.swf
trunk/research/players/srs_player/src/srs_player.as
trunk/research/players/jwplayer6.html
查看文件 @
5bfb561
...
...
@@ -21,6 +21,7 @@
$
(
"#div_container"
).
remove
();
_player
.
stop
();
});
$
(
"#main_modal"
).
on
(
"show"
,
function
(){
$
(
"#div_container"
).
remove
();
...
...
@@ -42,6 +43,7 @@
};
_player
=
jwplayer
(
'player_id'
).
setup
(
conf
);
});
$
(
"#main_modal"
).
modal
({
show
:
true
,
keyboard
:
false
});
}
...
...
trunk/research/players/srs_player.html
查看文件 @
5bfb561
...
...
@@ -14,13 +14,26 @@
}
</style>
<script
type=
"text/javascript"
>
var
srs_player
=
null
;
$
(
function
(){
// get the vhost and port to set the default url.
// for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo
// url set to: rtmp://demo:1935/live/livestream
srs_init
(
$
(
"#txt_url"
));
var
srs_player
=
null
;
$
(
"#btn_play"
).
click
(
on_btn_play
);
$
(
"#btn_pause"
).
click
(
function
(){
if
(
$
(
"#btn_pause"
).
text
()
==
"暂停"
)
{
$
(
"#btn_pause"
).
text
(
"继续"
);
srs_player
.
pause
();
}
else
{
$
(
"#btn_pause"
).
text
(
"暂停"
);
srs_player
.
resume
();
}
});
});
function
on_btn_play
(){
$
(
"#main_modal"
).
on
(
"show"
,
function
(){
$
(
"#div_container"
).
remove
();
...
...
@@ -35,34 +48,23 @@
var
url
=
$
(
"#txt_url"
).
val
();
srs_player
=
new
SrsPlayer
(
"player_id"
,
url
,
530
,
300
);
srs_player
=
new
SrsPlayer
(
"player_id"
,
url
,
530
,
300
,
0.8
);
srs_player
.
on_player_ready
=
function
()
{
// hack the callback function,
start to play the url
.
// hack the callback function,
do something then play
.
return
srs_player
.
play
();
}
srs_player
.
start
();
});
$
(
"#main_modal"
).
on
(
"hide"
,
function
(){
srs_player
.
stop
();
});
$
(
"#btn_play"
).
click
(
on_btn_play
);
$
(
"#btn_pause"
).
click
(
function
(){
var
_v
=
$
(
"#btn_pause"
).
text
();
if
(
_v
==
"暂停"
)
{
$
(
"#btn_pause"
).
text
(
"继续"
);
srs_player
.
pause
();
}
else
{
$
(
"#btn_pause"
).
text
(
"暂停"
);
srs_player
.
resume
();
}
});
});
function
on_btn_play
(){
$
(
"#main_modal"
).
modal
({
show
:
true
,
keyboard
:
false
});
}
function
SrsPlayer
(
container
,
stream_url
,
width
,
height
)
{
// the SrsPlayer object.
function
SrsPlayer
(
container
,
stream_url
,
width
,
height
,
buffer_time
)
{
if
(
!
SrsPlayer
.
__id
)
{
SrsPlayer
.
__id
=
100
;
}
...
...
@@ -76,9 +78,13 @@
this
.
stream_url
=
stream_url
;
this
.
width
=
width
;
this
.
height
=
height
;
this
.
buffer_time
=
buffer_time
;
this
.
id
=
SrsPlayer
.
__id
++
;
this
.
callbackObj
=
null
;
}
// user can set some callback, then start the player.
// callbacks:
// on_player_ready():int, when srs player ready, user can play.
SrsPlayer
.
prototype
.
start
=
function
()
{
// embed the flash.
var
flashvars
=
{};
...
...
@@ -105,7 +111,7 @@
return
this
;
}
SrsPlayer
.
prototype
.
play
=
function
()
{
return
this
.
callbackObj
.
ref
.
__play
(
this
.
stream_url
,
this
.
width
,
this
.
height
);
return
this
.
callbackObj
.
ref
.
__play
(
this
.
stream_url
,
this
.
width
,
this
.
height
,
this
.
buffer_time
);
}
SrsPlayer
.
prototype
.
stop
=
function
()
{
return
this
.
callbackObj
.
ref
.
__stop
();
...
...
trunk/research/players/srs_player/release/srs_player.swf
查看文件 @
5bfb561
不能预览此文件类型
trunk/research/players/srs_player/src/srs_player.as
查看文件 @
5bfb561
...
...
@@ -104,7 +104,7 @@ package
return
0
;
}
public
function
js_call_play
(
url
:
String
,
_width
:
int
,
_height
:
int
)
:
int
{
public
function
js_call_play
(
url
:
String
,
_width
:
int
,
_height
:
int
,
_buffer_time
:
Number
)
:
int
{
this
.
url
=
url
;
trace
(
"start to play url: "
+
this
.
url
)
;
...
...
@@ -120,6 +120,7 @@ package
}
stream
=
new
NetStream
(
conn
)
;
stream
.
bufferTime
=
_buffer_time
;
stream
.
client
=
{}
;
stream
.
client
.
onMetaData
=
function
(
metadata
:
Object
)
:
void
{
var
customItems
:
Array
=
[
new
ContextMenuItem
(
"SrsPlayer"
)]
;
...
...
请
注册
或
登录
后发表评论