Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
liowebrtc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sweng-group-15
liowebrtc
Commits
19027476
Commit
19027476
authored
6 years ago
by
lazorfuzz
Browse files
Options
Downloads
Patches
Plain Diff
Fix video chat example
parent
3559b4b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+10
-5
10 additions, 5 deletions
README.md
with
10 additions
and
5 deletions
README.md
+
10
−
5
View file @
19027476
...
...
@@ -129,6 +129,7 @@ class Party extends Component {
this
.
state
=
{
nick
:
this
.
props
.
nick
,
roomID
:
`party-
${
this
.
props
.
roomName
}
`
,
peers
:
[],
muted
:
false
,
camPaused
:
false
};
...
...
@@ -145,6 +146,7 @@ class Party extends Component {
autoRequestMedia
:
true
,
// Optional: nickname
nick
:
this
.
state
.
nick
,
debug
:
true
});
this
.
webrtc
.
on
(
'
videoAdded
'
,
this
.
addVideo
);
...
...
@@ -155,11 +157,15 @@ class Party extends Component {
}
addVideo
=
(
stream
,
peer
)
=>
{
this
.
webrtc
.
attachStream
(
stream
,
this
.
remoteVideos
[
peer
.
id
]);
this
.
setState
({
peers
:
[...
this
.
state
.
peers
,
peer
]
},
()
=>
{
this
.
webrtc
.
attachStream
(
stream
,
this
.
remoteVideos
[
peer
.
id
]);
});
}
removeVideo
=
(
peer
)
=>
{
// Clean up video
this
.
setState
({
peers
:
this
.
state
.
peers
.
filter
(
p
=>
!
p
.
closed
)
});
}
handleConnectionError
=
(
peer
)
=>
{
...
...
@@ -175,10 +181,9 @@ class Party extends Component {
}
// Show fellow peers in the room
generateRemotes
=
()
=>
this
.
webrtc
.
getP
eers
()
.
map
((
p
)
=>
(
generateRemotes
=
()
=>
this
.
state
.
p
eers
.
map
((
p
)
=>
(
<
div
key
=
{
p
.
id
}
>
// The video parent container needs a special id
<
div
id
=
{
`
${
this
.
webrtc
.
getContainerId
(
p
)}
`
}
>
<
div
id
=
{
/* The video container needs a special id */
`
${
this
.
webrtc
.
getContainerId
(
p
)}
`
}
>
<
video
key
=
{
this
.
webrtc
.
getId
(
p
)
}
// Important: The video element needs both an id and ref
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment