Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
e11db8f8
Commit
e11db8f8
authored
6 years ago
by
Greg Fodor
Browse files
Options
Downloads
Patches
Plain Diff
Refactor fake webrtc:// scheme into
hubs://client/<client
id>/video
parent
6ed4af3f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/media-views.js
+3
-3
3 additions, 3 deletions
src/components/media-views.js
src/utils/media-utils.js
+4
-5
4 additions, 5 deletions
src/utils/media-utils.js
src/utils/pinned-entity-to-gltf.js
+2
-2
2 additions, 2 deletions
src/utils/pinned-entity-to-gltf.js
with
9 additions
and
10 deletions
src/components/media-views.js
+
3
−
3
View file @
e11db8f8
...
...
@@ -86,10 +86,10 @@ async function createVideoEl(src) {
videoEl
.
loop
=
true
;
videoEl
.
crossOrigin
=
"
anonymous
"
;
if
(
!
src
.
startsWith
(
"
webrtc
://
"
))
{
if
(
!
src
.
startsWith
(
"
hubs
://
"
))
{
videoEl
.
src
=
src
;
}
else
{
const
streamClientId
=
src
.
substring
(
9
);
const
streamClientId
=
src
.
substring
(
7
).
split
(
"
/
"
)[
1
];
// /clients/<client id>/video is only URL for now
const
stream
=
await
NAF
.
connection
.
adapter
.
getMediaStream
(
streamClientId
,
"
video
"
);
videoEl
.
srcObject
=
new
MediaStream
(
stream
.
getVideoTracks
());
}
...
...
@@ -327,7 +327,7 @@ AFRAME.registerComponent("media-video", {
return
;
}
if
(
!
src
.
startsWith
(
"
webrtc
://
"
))
{
if
(
!
src
.
startsWith
(
"
hubs
://
"
))
{
// TODO FF error here if binding mediastream: The captured HTMLMediaElement is playing a MediaStream. Applying volume or mute status is not currently supported -- not an issue since we have no audio atm in shared video.
texture
.
audioSource
=
this
.
el
.
sceneEl
.
audioListener
.
context
.
createMediaElementSource
(
texture
.
image
);
...
...
This diff is collapsed.
Click to expand it.
src/utils/media-utils.js
+
4
−
5
View file @
e11db8f8
...
...
@@ -22,7 +22,7 @@ function b64EncodeUnicode(str) {
}
export
const
proxiedUrlFor
=
(
url
,
index
)
=>
{
if
(
url
.
startsWith
(
"
webrtc://
"
))
return
url
;
if
(
!
(
url
.
startsWith
(
"
http:
"
)
||
url
.
startsWith
(
"
https:
"
)
))
return
url
;
// farspark doesn't know how to read '=' base64 padding characters
const
base64Url
=
b64EncodeUnicode
(
url
).
replace
(
/=+$/g
,
""
);
...
...
@@ -46,7 +46,7 @@ export const resolveUrl = async (url, index) => {
};
export
const
guessContentType
=
url
=>
{
if
(
url
.
startsWith
(
"
webrtc://
"
))
return
"
video/webrtc
"
;
if
(
url
.
startsWith
(
"
hubs://
"
)
&&
url
.
endsWith
(
"
/video
"
))
return
"
video/
vnd.hubs-
webrtc
"
;
const
extension
=
new
URL
(
url
).
pathname
.
split
(
"
.
"
).
pop
();
return
commonKnownContentTypes
[
extension
];
};
...
...
@@ -128,9 +128,8 @@ export const addMedia = (src, template, contentOrigin, resolve = false, resize =
.
catch
(()
=>
{
entity
.
setAttribute
(
"
media-loader
"
,
{
src
:
"
error
"
});
});
}
if
(
src
instanceof
MediaStream
)
{
entity
.
setAttribute
(
"
media-loader
"
,
{
src
:
`webrtc://
${
NAF
.
clientId
}
`
});
}
else
if
(
src
instanceof
MediaStream
)
{
entity
.
setAttribute
(
"
media-loader
"
,
{
src
:
`hubs://clients/
${
NAF
.
clientId
}
/video`
});
}
if
(
contentOrigin
)
{
...
...
This diff is collapsed.
Click to expand it.
src/utils/pinned-entity-to-gltf.js
+
2
−
2
View file @
e11db8f8
...
...
@@ -22,8 +22,8 @@ export default function pinnedEntityToGltf(el) {
if
(
components
[
"
media-loader
"
])
{
const
mediaSrc
=
components
[
"
media-loader
"
].
data
.
src
;
if
(
mediaSrc
.
startsWith
(
"
webrtc://
"
))
{
// Do not persist
webrtc media share
s
if
(
mediaSrc
.
startsWith
(
"
hubs://
"
)
&&
mediaSrc
.
endsWith
(
"
/video
"
))
{
// Do not persist
hubs client video url
s
return
null
;
}
...
...
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