Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
5f0aeaa3
Commit
5f0aeaa3
authored
Apr 04, 2021
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
区分推流和播放
parent
f33d3ba1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
100 行增加
和
2 行删除
+100
-2
www/webrtc/index_play.html
+2
-2
www/webrtc/index_push.html
+98
-0
没有找到文件。
www/webrtc/index.html
→
www/webrtc/index
_play
.html
查看文件 @
5f0aeaa3
...
...
@@ -22,12 +22,12 @@
<p>
<label
for=
"streamUrl"
>
url:
</label>
<input
type=
"text"
id=
'streamUrl'
value=
"http
s://rp.zlmediakit.com:20443/index/api/webrtc?app=live&stream=test
"
>
<input
type=
"text"
id=
'streamUrl'
value=
"http
://127.0.0.1/index/api/webrtc?app=live&stream=test&type=play
"
>
</p>
<p>
<label
for=
"simulecast"
>
simulecast:
</label>
<input
type=
"checkbox"
id=
'simulecast'
checked=
"checked"
>
<input
type=
"checkbox"
id=
'simulecast'
>
</p>
<button
onclick=
"start()"
>
开始
</button>
<button
onclick=
"stop()"
>
停止
</button>
...
...
www/webrtc/index_push.html
0 → 100644
查看文件 @
5f0aeaa3
<html>
<meta
charset=
"utf-8"
>
<head>
<title>
ZLM RTC demo
</title>
<script
src=
"./ZLMRTCClient.js"
></script>
</head>
<body>
<div
style=
"text-align: center;"
>
<div>
<video
id=
'video'
controls
autoplay
style=
"text-align:left;"
>
Your browser is too old which doesn't support HTML5 video.
</video>
<video
id=
'selfVideo'
controls
autoplay
style=
"text-align:right;"
>
Your browser is too old which doesn't support HTML5 video.
</video>
</div>
<div>
<p>
<label
for=
"streamUrl"
>
url:
</label>
<input
type=
"text"
id=
'streamUrl'
value=
"http://127.0.0.1/index/api/webrtc?app=live&stream=test&type=push"
>
</p>
<p>
<label
for=
"simulecast"
>
simulecast:
</label>
<input
type=
"checkbox"
id=
'simulecast'
>
</p>
<button
onclick=
"start()"
>
开始
</button>
<button
onclick=
"stop()"
>
停止
</button>
</div>
</div>
<script>
var
player
=
null
function
start
()
{
stop
();
player
=
new
ZLMRTCClient
.
Endpoint
(
{
element
:
document
.
getElementById
(
'video'
),
// video 标签
debug
:
true
,
// 是否打印日志
zlmsdpUrl
:
document
.
getElementById
(
'streamUrl'
).
value
,
//流地址
simulecast
:
document
.
getElementById
(
'simulecast'
).
checked
}
);
player
.
on
(
ZLMRTCClient
.
Events
.
WEBRTC_ICE_CANDIDATE_ERROR
,
function
(
e
)
{
// ICE 协商出错
console
.
log
(
'ICE 协商出错'
)
});
player
.
on
(
ZLMRTCClient
.
Events
.
WEBRTC_ON_REMOTE_STREAMS
,
function
(
e
)
{
//获取到了远端流,可以播放
console
.
log
(
'播放成功'
,
e
.
streams
)
});
player
.
on
(
ZLMRTCClient
.
Events
.
WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED
,
function
(
e
)
{
// offer anwser 交换失败
console
.
log
(
'offer anwser 交换失败'
,
e
)
});
player
.
on
(
ZLMRTCClient
.
Events
.
WEBRTC_ON_LOCAL_STREAM
,
function
(
s
)
{
// 获取到了本地流
document
.
getElementById
(
'selfVideo'
).
srcObject
=
s
;
//console.log('offer anwser 交换失败',e)
});
}
function
stop
()
{
if
(
player
)
{
player
.
close
();
player
=
null
;
var
local
=
document
.
getElementById
(
'selfVideo'
);
local
.
removeAttribute
(
'srcObject'
);
local
.
load
();
}
}
</script>
</body>
<script>
</script>
</html>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论