Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
standalone-anyremote
Overview
Overview
Details
Activity
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
qlintonger xeno
standalone-anyremote
Commits
76a6f6b3
Commit
76a6f6b3
authored
Apr 30, 2024
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
转换绝对引入为相对引入,AnyR=>.+
parent
186b7821
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
80 deletions
+86
-80
anyremote/agora/index.js
+83
-77
index.html
+0
-1
public/AgoraRTC_N-4.19.1.js
+0
-0
vite.config.ts
+3
-2
No files found.
anyremote/agora/index.js
View file @
76a6f6b3
...
@@ -180,94 +180,100 @@ export class Agora {
...
@@ -180,94 +180,100 @@ export class Agora {
}
}
async
preload
()
{
async
preload
()
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
v
=
setInterval
(()
=>
{
console
.
trace
()
if
(
window
.
AgoraRTC
)
{
import
(
"./AgoraRTC_N-4.19.1.js?url"
)
clearInterval
(
v
);
.
then
((
url
)
=>
{
if
(
this
.
notUploadLog
)
{
console
.
log
(
'the url here'
,
url
)
AgoraRTC
.
disableLogUpload
();
const
s
=
document
.
createElement
(
'script'
);
}
s
.
src
=
url
.
default
;
AgoraRTC
.
setLogLevel
(
this
.
logLevel
);
s
.
onerror
=
reject
;
this
.
AgoraClient
=
AgoraRTC
.
createClient
({
mode
:
this
.
mode
,
codec
:
this
.
codec
});
s
.
onload
=
()
=>
{
this
.
AgoraClient
.
on
(
'volume-indicator'
,
function
(
volumes
)
{
if
(
this
.
notUploadLog
)
{
chatChannelState
.
value
.
volumeSet
=
volumes
;
AgoraRTC
.
disableLogUpload
();
})
}
console
.
log
(
'client 已经创建'
,
this
.
AgoraClient
)
AgoraRTC
.
setLogLevel
(
this
.
logLevel
);
window
.
navigator
.
mediaDevices
.
enumerateDevices
()
this
.
AgoraClient
=
AgoraRTC
.
createClient
({
mode
:
this
.
mode
,
codec
:
this
.
codec
});
.
then
(
function
(
info
)
{
this
.
AgoraClient
.
on
(
'volume-indicator'
,
function
(
volumes
)
{
const
wholeCameraSet
=
info
.
filter
(
a
=>
a
.
kind
===
'videoinput'
);
chatChannelState
.
value
.
volumeSet
=
volumes
;
webrtcStates
.
value
.
cameraDeviceSet
=
wholeCameraSet
;
webrtcStates
.
value
.
isCameraAttached
=
wholeCameraSet
.
length
>
0
webrtcStates
.
value
.
isMicroAttached
=
info
.
filter
(
a
=>
a
.
kind
===
'audioinput'
).
length
>
0
;
console
.
log
(
'当前设备状况'
,
info
,
chatChannelState
.
value
)
})
})
AgoraRTC
.
onCameraChanged
=
function
()
{
console
.
log
(
'client 已经创建'
,
this
.
AgoraClient
)
window
.
navigator
.
mediaDevices
.
enumerateDevices
()
window
.
navigator
.
mediaDevices
.
enumerateDevices
()
.
then
(
function
(
info
)
{
.
then
(
function
(
info
)
{
const
wholeCameraSet
=
info
.
filter
(
a
=>
a
.
kind
===
'videoinput'
);
const
wholeCameraSet
=
info
.
filter
(
a
=>
a
.
kind
===
'videoinput'
);
webrtcStates
.
value
.
cameraDeviceSet
=
wholeCameraSet
;
webrtcStates
.
value
.
cameraDeviceSet
=
wholeCameraSet
;
webrtcStates
.
value
.
isCameraAttached
=
wholeCameraSet
.
length
>
0
webrtcStates
.
value
.
isCameraAttached
=
wholeCameraSet
.
length
>
0
})
}
AgoraRTC
.
onMicrophoneChanged
=
function
()
{
window
.
navigator
.
mediaDevices
.
enumerateDevices
()
.
then
(
function
(
info
)
{
webrtcStates
.
value
.
isMicroAttached
=
info
.
filter
(
a
=>
a
.
kind
===
'audioinput'
).
length
>
0
;
webrtcStates
.
value
.
isMicroAttached
=
info
.
filter
(
a
=>
a
.
kind
===
'audioinput'
).
length
>
0
;
console
.
log
(
'当前设备状况'
,
info
,
chatChannelState
.
value
)
})
})
}
AgoraRTC
.
onCameraChanged
=
function
()
{
this
.
AgoraClient
.
on
(
'user-joined'
,
(
user
)
=>
{
window
.
navigator
.
mediaDevices
.
enumerateDevices
()
const
uidS
=
user
.
uid
.
toString
()
.
then
(
function
(
info
)
{
const
targetUser
=
userStates
.
value
.
onlineContacts
.
find
(
a
=>
a
.
fromID
.
toString
()
===
uidS
);
const
wholeCameraSet
=
info
.
filter
(
a
=>
a
.
kind
===
'videoinput'
);
console
.
log
(
'在线用户加入了频道'
,
targetUser
)
webrtcStates
.
value
.
cameraDeviceSet
=
wholeCameraSet
;
targetUser
.
callState
=
'calling'
webrtcStates
.
value
.
isCameraAttached
=
wholeCameraSet
.
length
>
0
if
(
!
chatChannelState
.
value
.
currentChatters
.
includes
(
uidS
))
{
})
chatChannelState
.
value
.
currentChatters
.
push
(
uidS
)
}
}
})
AgoraRTC
.
onMicrophoneChanged
=
function
()
{
this
.
AgoraClient
.
on
(
'user-left'
,
(
user
)
=>
{
window
.
navigator
.
mediaDevices
.
enumerateDevices
()
const
uidS
=
user
.
uid
.
toString
()
.
then
(
function
(
info
)
{
const
targetUser
=
userStates
.
value
.
onlineContacts
.
find
(
a
=>
a
.
fromID
.
toString
()
===
uidS
);
webrtcStates
.
value
.
isMicroAttached
=
info
.
filter
(
a
=>
a
.
kind
===
'audioinput'
).
length
>
0
;
console
.
log
(
'在线用户离开了频道'
,
targetUser
)
})
if
(
chatChannelState
.
value
.
currentChatters
.
includes
(
uidS
))
{
chatChannelState
.
value
.
currentChatters
.
splice
(
chatChannelState
.
value
.
currentChatters
.
indexOf
(
uidS
),
1
)
}
}
})
this
.
AgoraClient
.
on
(
'user-joined'
,
(
user
)
=>
{
this
.
AgoraClient
.
on
(
'user-published'
,
(
user
,
mediaType
)
=>
{
const
uidS
=
user
.
uid
.
toString
()
console
.
log
(
'检测到远程用户发布媒体'
,
user
,
mediaType
);
const
targetUser
=
userStates
.
value
.
onlineContacts
.
find
(
a
=>
a
.
fromID
.
toString
()
===
uidS
);
if
(
user
.
uid
.
toString
()
!==
this
.
data
.
uid
.
toString
())
{
console
.
log
(
'在线用户加入了频道'
,
targetUser
)
this
.
#
subscribe
(
user
,
mediaType
)
targetUser
.
callState
=
'calling'
}
if
(
!
chatChannelState
.
value
.
currentChatters
.
includes
(
uidS
))
{
if
(
mediaType
===
'audio'
)
{
chatChannelState
.
value
.
currentChatters
.
push
(
uidS
)
chatChannelState
.
value
.
mutedUserIdSet
=
chatChannelState
.
value
.
mutedUserIdSet
.
filter
(
i
=>
i
!==
user
.
uid
);
}
})
this
.
AgoraClient
.
on
(
'user-unpublished'
,
async
(
user
,
mediaType
)
=>
{
console
.
log
(
'检测到远程用户取消发布媒体'
,
user
,
mediaType
);
if
(
user
.
uid
.
toString
()
!==
this
.
data
.
uid
.
toString
())
{
await
this
.
AgoraClient
.
unsubscribe
(
user
,
mediaType
);
}
if
(
mediaType
===
'audio'
)
{
if
(
!
chatChannelState
.
value
.
mutedUserIdSet
.
includes
(
user
.
uid
))
{
chatChannelState
.
value
.
mutedUserIdSet
.
push
(
user
.
uid
);
}
}
user
?.
audioTrack
?.
stop
()
})
}
this
.
AgoraClient
.
on
(
'user-left'
,
(
user
)
=>
{
if
(
mediaType
===
'video'
)
{
const
uidS
=
user
.
uid
.
toString
()
user
?.
videoTrack
?.
stop
()
const
targetUser
=
userStates
.
value
.
onlineContacts
.
find
(
a
=>
a
.
fromID
.
toString
()
===
uidS
);
}
console
.
log
(
'在线用户离开了频道'
,
targetUser
)
})
if
(
chatChannelState
.
value
.
currentChatters
.
includes
(
uidS
))
{
this
.
AgoraClient
.
on
(
'network-quality'
,
quality
=>
{
chatChannelState
.
value
.
currentChatters
.
splice
(
chatChannelState
.
value
.
currentChatters
.
indexOf
(
uidS
),
1
)
if
(
chatChannelState
.
value
.
currentChatters
.
length
===
0
)
{
}
return
;
})
}
this
.
AgoraClient
.
on
(
'user-published'
,
(
user
,
mediaType
)
=>
{
const
{
downlinkNetworkQuality
:
down
,
uplinkNetworkQuality
:
up
}
=
quality
console
.
log
(
'检测到远程用户发布媒体'
,
user
,
mediaType
);
webrtcStates
.
value
.
networkQuality
=
{
if
(
user
.
uid
.
toString
()
!==
this
.
data
.
uid
.
toString
())
{
down
,
up
this
.
#
subscribe
(
user
,
mediaType
)
};
}
})
if
(
mediaType
===
'audio'
)
{
resolve
();
chatChannelState
.
value
.
mutedUserIdSet
=
chatChannelState
.
value
.
mutedUserIdSet
.
filter
(
i
=>
i
!==
user
.
uid
);
}
}
})
})
this
.
AgoraClient
.
on
(
'user-unpublished'
,
async
(
user
,
mediaType
)
=>
{
console
.
log
(
'检测到远程用户取消发布媒体'
,
user
,
mediaType
);
if
(
user
.
uid
.
toString
()
!==
this
.
data
.
uid
.
toString
())
{
await
this
.
AgoraClient
.
unsubscribe
(
user
,
mediaType
);
}
if
(
mediaType
===
'audio'
)
{
if
(
!
chatChannelState
.
value
.
mutedUserIdSet
.
includes
(
user
.
uid
))
{
chatChannelState
.
value
.
mutedUserIdSet
.
push
(
user
.
uid
);
}
user
?.
audioTrack
?.
stop
()
}
if
(
mediaType
===
'video'
)
{
user
?.
videoTrack
?.
stop
()
}
})
this
.
AgoraClient
.
on
(
'network-quality'
,
quality
=>
{
if
(
chatChannelState
.
value
.
currentChatters
.
length
===
0
)
{
return
;
}
const
{
downlinkNetworkQuality
:
down
,
uplinkNetworkQuality
:
up
}
=
quality
webrtcStates
.
value
.
networkQuality
=
{
down
,
up
};
})
resolve
();
}
document
.
body
.
append
(
s
);
})
})
})
}
}
...
...
index.html
View file @
76a6f6b3
...
@@ -9,6 +9,5 @@
...
@@ -9,6 +9,5 @@
<body>
<body>
<div
id=
"app"
></div>
<div
id=
"app"
></div>
<script
type=
"module"
src=
"/src/main.ts"
></script>
<script
type=
"module"
src=
"/src/main.ts"
></script>
<script
defer
async
src=
"./AgoraRTC_N-4.19.1.js"
></script>
</body>
</body>
</html>
</html>
public/AgoraRTC_N-4.19.1.js
deleted
100644 → 0
View file @
186b7821
This source diff could not be displayed because it is too large. You can
view the blob
instead.
vite.config.ts
View file @
76a6f6b3
...
@@ -33,7 +33,8 @@ export default defineConfig({
...
@@ -33,7 +33,8 @@ export default defineConfig({
AutoImport
({
AutoImport
({
imports
:
[
'vue'
,
'vue-router'
],
imports
:
[
'vue'
,
'vue-router'
],
dts
:
'src/auto-import.d.ts'
,
dts
:
'src/auto-import.d.ts'
,
resolvers
:
[
ArcoResolver
()]
resolvers
:
[
ArcoResolver
()],
exclude
:
[
'anyremote/agora/AgoraRTC_N-4.19.1.js'
]
}),
}),
Components
({
Components
({
// 自动导入的组件位置,默认是src/components
// 自动导入的组件位置,默认是src/components
...
@@ -71,6 +72,6 @@ export default defineConfig({
...
@@ -71,6 +72,6 @@ export default defineConfig({
cors
:
true
// 跨域
cors
:
true
// 跨域
},
},
optimizeDeps
:
{
optimizeDeps
:
{
exclude
:
[
'
AnyR
/agora/AgoraRTC_N-4.19.1.js'
]
exclude
:
[
'
anyremote
/agora/AgoraRTC_N-4.19.1.js'
]
}
}
})
})
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