Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
h5wawa-demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
康旭峰
h5wawa-demo
Commits
a0d8d1c6
Commit
a0d8d1c6
authored
Jan 24, 2018
by
likely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
eca83b4e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
7 deletions
+93
-7
index.html
index.html
+4
-6
index.js
index.js
+11
-0
android.js
libs/android.js
+68
-1
ios.js
libs/ios.js
+10
-0
No files found.
index.html
View file @
a0d8d1c6
...
...
@@ -4,12 +4,10 @@
</head>
<body>
<!-- 正面摄像头 -->
<canvas
id=
"front_video"
width=
"480"
height=
"860"
></canvas>
<!-- 侧面摄像头 -->
<canvas
id=
"side_video"
width=
"480"
height=
"860"
></canvas>
<script
src=
"//sqimg.qq.com/expert_qq/wawaji/TXWawaPlayer.beta4.min.js"
></script>
<div
id=
"lvb"
></div>
<video
wiDth=
"200"
height=
"300"
autoplay
playsinline
></video>
<video
id=
"remoteVideo"
autoplay
playsinline
></video>
<script
src=
"https://imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.2.1.js"
charset=
"utf-8"
></script>
<script
src=
"index.js"
></script>
</body>
...
...
index.js
View file @
a0d8d1c6
...
...
@@ -2,6 +2,17 @@ var insert = require('./utils/insertscript');
var
ios
=
require
(
'./libs/ios'
);
var
android
=
require
(
'./libs/android'
);
new
TcPlayer
(
'lvb'
,
{
"m3u8"
:
"http://14246.liveplay.myqcloud.com/live/14246_055dd098ab729831abff0c1f55536403.m3u8"
,
"autoplay"
:
true
,
//iOS下safari浏览器是不开放这个能力的
"width"
:
"100%"
,
"height"
:
"100vh"
,
"wording"
:
{
2032
:
"请求视频失败,请检查网络"
,
2048
:
"请求m3u8文件失败,可能是网络错误或者跨域问题"
}
});
var
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
if
(
/iphone|ipad|ipod/gi
.
test
(
ua
))
{
...
...
libs/android.js
View file @
a0d8d1c6
module
.
exports
=
function
()
{
console
.
log
(
'android'
);
WebRTCAPI
.
init
({
onInitResult
:
function
(
result
)
{
console
.
log
(
"on init result : "
+
result
);
if
(
result
!==
0
)
{
var
errorStr
=
""
;
if
(
result
===
-
10001
)
{
errorStr
=
"WebRTCJSAPI初始化参数不正确"
;
}
else
if
(
result
===
-
10002
)
{
errorStr
=
"浏览器版本不正确"
;
}
else
if
(
result
===
-
10003
)
{
errorStr
=
"sig校验失败"
;
}
else
if
(
result
===
-
10006
)
{
errorStr
=
"WebSocket 初始化失败"
;
}
else
{
errorStr
=
"初始化错误"
;
}
console
.
log
(
errorStr
);
}
else
{
//创建房间
WebRTCAPI
.
createRoom
({
roomid
:
RoomNumber
,
role
:
Role
},
onCreateRoomCallback
);
}
},
onLocalStreamAdd
:
function
(
e
)
{
},
onRemoteStreamAdd
:
function
(
stream
,
videoId
)
{
var
videoElement
=
document
.
getElementById
(
"remoteVideo"
);
videoElement
.
srcObject
=
stream
;
},
onRemoteStreamRemove
:
function
(
videoId
)
{
var
videoElement
=
document
.
getElementById
(
videoId
)
//特别注意,这里要把videoElement的srcObject置空
videoElement
.
srcObject
=
null
videoElement
.
parentNode
.
removeChild
(
videoElement
)
},
onUpdateRemoteStream
:
function
(
stream
,
videoId
,
type
,
ssrState
,
openId
)
{
var
videoElement
=
document
.
getElementById
(
videoId
);
videoElement
.
parentNode
.
removeChild
(
videoElement
)
//这里调用remotestreamadd的回调函数
onRemoteStreamAdd
(
stream
,
videoId
,
openId
);
},
onKickout
:
function
()
{
alert
(
"其他地方登录,被T下线"
)
},
onWebSocketClose
:
function
()
{
//断开后的处理
WebRTCAPI
.
quit
();
},
onRelayTimeout
:
function
(
e
)
{
console
.
log
(
e
)
},
onIceConnectionClose
:
function
()
{
},
onChangeRemoteStreamState
:
function
()
{
}
},
{
openid
:
"1574"
,
sdkAppId
:
1400050371
,
accountType
:
19242
,
userSig
:
"eJxFkFFPgzAUhf8LrzNyCytVEx-qYGQGE8fAZHtpKnTkOmEddAM0-neRjPh6vtyc79xvK4k2t1JrzIU0wq1z68EC62aMVaexVkLujaqHmFBKHYCJXlTd4LEagAOEEscF*IeYq8rgHsdDzjm9v4IGiyF5CdLFyk-t*LCLi26RaB9ksA6Lks1t8hSuGnnq4*VH28PsEpEy4xjw1t62Jf1iBN8*qyXwu-dot-UTrzinJx2Em3XCQxV3s*dX-jiV5Qcxbvuznw92FFxGrtBgqcZVxGOeS9lkKLPseK6MML1W4zN*fgGy2FYp"
})
}
\ No newline at end of file
libs/ios.js
View file @
a0d8d1c6
module
.
exports
=
function
()
{
var
ele1
=
document
.
createElement
(
'canvas'
)
ele1
.
id
=
'front_video'
ele1
.
width
=
"480px"
ele1
.
height
=
"860px"
var
ele2
=
document
.
createElement
(
'canvas'
)
ele2
.
id
=
'side_video'
ele2
.
width
=
"480px"
ele2
.
height
=
"860px"
document
.
body
.
appendChild
(
ele1
)
document
.
body
.
appendChild
(
ele2
)
TXWawaVideo
.
init
({
sdkappid
:
1400050371
,
accounttype
:
19242
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment