ui搭建完成
This commit is contained in:
9178
Assets/Prefab/MainPanel.prefab
Normal file
9178
Assets/Prefab/MainPanel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefab/MainPanel.prefab.meta
Normal file
7
Assets/Prefab/MainPanel.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11ac2a591441d5940b0b146f6dd3025e
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2912
Assets/Prefab/StartPanel.prefab
Normal file
2912
Assets/Prefab/StartPanel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefab/StartPanel.prefab.meta
Normal file
7
Assets/Prefab/StartPanel.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92d5b3b398289344db69a70f3830a8e4
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -16,13 +16,12 @@ namespace Unity.RenderStreaming
|
|||||||
/// 2. 在Inspector中关联各字段
|
/// 2. 在Inspector中关联各字段
|
||||||
/// 3. participantVideoContainer 需要挂载 GridLayoutGroup 或 VerticalLayoutGroup
|
/// 3. participantVideoContainer 需要挂载 GridLayoutGroup 或 VerticalLayoutGroup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RequireComponent(typeof(HostConnection))]
|
public class MultiParticipantHost : MonoBehaviour
|
||||||
public class MultiParticipantHostSample : MonoBehaviour
|
|
||||||
{
|
{
|
||||||
#pragma warning disable 0649
|
|
||||||
[Header("核心组件")]
|
[Header("核心组件")]
|
||||||
[SerializeField] private SignalingManager renderStreaming;
|
private SignalingManager renderStreaming;
|
||||||
[SerializeField] private HostConnection hostConnection;
|
private HostConnection hostConnection;
|
||||||
|
|
||||||
[Header("Host本地视频")]
|
[Header("Host本地视频")]
|
||||||
[SerializeField] private VideoStreamSender videoStreamSender;
|
[SerializeField] private VideoStreamSender videoStreamSender;
|
||||||
@@ -40,10 +39,8 @@ namespace Unity.RenderStreaming
|
|||||||
[SerializeField] private InputField connectionIdInput;
|
[SerializeField] private InputField connectionIdInput;
|
||||||
[SerializeField] private Dropdown webcamSelectDropdown;
|
[SerializeField] private Dropdown webcamSelectDropdown;
|
||||||
[SerializeField] private Dropdown microphoneSelectDropdown;
|
[SerializeField] private Dropdown microphoneSelectDropdown;
|
||||||
|
|
||||||
|
|
||||||
#pragma warning restore 0649
|
|
||||||
|
|
||||||
private string connectionId;
|
|
||||||
private RenderStreamingSettings settings;
|
private RenderStreamingSettings settings;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -60,6 +57,8 @@ namespace Unity.RenderStreaming
|
|||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
renderStreaming=GameObject.FindObjectOfType<SignalingManager>();
|
||||||
|
hostConnection=GameObject.FindObjectOfType<HostConnection>();
|
||||||
startButton.interactable = true;
|
startButton.interactable = true;
|
||||||
// 初始化UI
|
// 初始化UI
|
||||||
setUpButton.interactable = true;
|
setUpButton.interactable = true;
|
||||||
@@ -76,7 +75,7 @@ namespace Unity.RenderStreaming
|
|||||||
});
|
});
|
||||||
setUpButton.onClick.AddListener(SetUp);
|
setUpButton.onClick.AddListener(SetUp);
|
||||||
hangUpButton.onClick.AddListener(HangUp);
|
hangUpButton.onClick.AddListener(HangUp);
|
||||||
connectionIdInput.onValueChanged.AddListener(input => connectionId = input);
|
connectionIdInput.onValueChanged.AddListener(input => hostConnection.RoomConnectionId = input);
|
||||||
connectionIdInput.text = $"{Random.Range(0, 99999):D5}";
|
connectionIdInput.text = $"{Random.Range(0, 99999):D5}";
|
||||||
|
|
||||||
// 本地视频:Sender启动后显示
|
// 本地视频:Sender启动后显示
|
||||||
@@ -130,12 +129,12 @@ namespace Unity.RenderStreaming
|
|||||||
if (settings != null)
|
if (settings != null)
|
||||||
videoStreamSender.SetCodec(settings.SenderVideoCodec);
|
videoStreamSender.SetCodec(settings.SenderVideoCodec);
|
||||||
|
|
||||||
hostConnection.CreateConnection(connectionId);
|
hostConnection.CreateConnection(hostConnection.RoomConnectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HangUp()
|
private void HangUp()
|
||||||
{
|
{
|
||||||
hostConnection.DeleteConnection(connectionId);
|
hostConnection.DeleteConnection(hostConnection.RoomConnectionId);
|
||||||
|
|
||||||
// 清理所有Participant UI
|
// 清理所有Participant UI
|
||||||
foreach (var ui in participantUIs.Values)
|
foreach (var ui in participantUIs.Values)
|
||||||
@@ -11,7 +11,7 @@ namespace Unity.RenderStreaming
|
|||||||
{
|
{
|
||||||
public class MessageChannel : DataChannelBase
|
public class MessageChannel : DataChannelBase
|
||||||
{
|
{
|
||||||
public event Action<string, UserInfo> OnMessageReceived;
|
public event Action<string, UserInfo> OnUserInfoMessageReceived;
|
||||||
public event Action<string, MediaStateChange> OnMediaStateChangeReceived;
|
public event Action<string, MediaStateChange> OnMediaStateChangeReceived;
|
||||||
|
|
||||||
[Header("消息记录")] [SerializeField, TextArea(1, 3)]
|
[Header("消息记录")] [SerializeField, TextArea(1, 3)]
|
||||||
@@ -41,7 +41,8 @@ namespace Unity.RenderStreaming
|
|||||||
{
|
{
|
||||||
record = new MessageRecord { type = "raw", data = message };
|
record = new MessageRecord { type = "raw", data = message };
|
||||||
}
|
}
|
||||||
|
record.timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||||
|
ConnectionId=record.connectionId;
|
||||||
JObject json = null;
|
JObject json = null;
|
||||||
switch (record.type)
|
switch (record.type)
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,7 @@ namespace Unity.RenderStreaming
|
|||||||
case MessageTypes.UserInfo:
|
case MessageTypes.UserInfo:
|
||||||
json = record.data as JObject;
|
json = record.data as JObject;
|
||||||
var info = json.ToObject<UserInfo>();
|
var info = json.ToObject<UserInfo>();
|
||||||
OnMessageReceived?.Invoke(ConnectionId, info);
|
OnUserInfoMessageReceived?.Invoke(ConnectionId, info);
|
||||||
break;
|
break;
|
||||||
case MessageTypes.MediaStateChange:
|
case MessageTypes.MediaStateChange:
|
||||||
json = record.data as JObject;
|
json = record.data as JObject;
|
||||||
@@ -112,6 +113,8 @@ namespace Unity.RenderStreaming
|
|||||||
public object data;
|
public object data;
|
||||||
public bool isSent;
|
public bool isSent;
|
||||||
public string timestamp = DateTime.Now.ToString();
|
public string timestamp = DateTime.Now.ToString();
|
||||||
|
public string connectionId;
|
||||||
|
public string participantId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ TextureImporter:
|
|||||||
alignment: 0
|
alignment: 0
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
spritePixelsToUnits: 100
|
spritePixelsToUnits: 100
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 61, y: 45, z: 58, w: 61}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 1
|
||||||
@@ -126,7 +126,7 @@ TextureImporter:
|
|||||||
physicsShape: []
|
physicsShape: []
|
||||||
bones: []
|
bones: []
|
||||||
spriteID: 5e97eb03825dee720800000000000000
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
internalID: 0
|
internalID: 1537655665
|
||||||
vertices: []
|
vertices: []
|
||||||
indices:
|
indices:
|
||||||
edges: []
|
edges: []
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ TextureImporter:
|
|||||||
alignment: 0
|
alignment: 0
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
spritePixelsToUnits: 100
|
spritePixelsToUnits: 100
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 50, y: 50, z: 50, w: 50}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 1
|
||||||
@@ -126,7 +126,7 @@ TextureImporter:
|
|||||||
physicsShape: []
|
physicsShape: []
|
||||||
bones: []
|
bones: []
|
||||||
spriteID: 5e97eb03825dee720800000000000000
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
internalID: 0
|
internalID: 1537655665
|
||||||
vertices: []
|
vertices: []
|
||||||
indices:
|
indices:
|
||||||
edges: []
|
edges: []
|
||||||
|
|||||||
BIN
Assets/Sprite/Meeting - Main/属性 1=title+3 button@1x.png
Normal file
BIN
Assets/Sprite/Meeting - Main/属性 1=title+3 button@1x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
140
Assets/Sprite/Meeting - Main/属性 1=title+3 button@1x.png.meta
Normal file
140
Assets/Sprite/Meeting - Main/属性 1=title+3 button@1x.png.meta
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f7bdf7736eea4e46904736d5d7b955a
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 270, y: 320, z: 270, w: 200}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 1537655665
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -49,6 +49,11 @@ namespace Unity.RenderStreaming
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private string roomConnectionId;
|
private string roomConnectionId;
|
||||||
|
|
||||||
|
public string RoomConnectionId
|
||||||
|
{
|
||||||
|
get { return roomConnectionId; }
|
||||||
|
set { roomConnectionId = value; }
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 每个Participant的独立Receiver(key=participantId)
|
/// 每个Participant的独立Receiver(key=participantId)
|
||||||
/// VideoStreamReceiver/AudioStreamReceiver内部只持有一个transceiver,
|
/// VideoStreamReceiver/AudioStreamReceiver内部只持有一个transceiver,
|
||||||
@@ -323,7 +328,9 @@ namespace Unity.RenderStreaming
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void OnMessage(SignalingEventData eventData)
|
public void OnMessage(SignalingEventData eventData)
|
||||||
{
|
{
|
||||||
|
// eventData.
|
||||||
Debug.Log($"[HostConnection] Message from: {eventData.connectionId}, participantId: {eventData.participantId}, message: {eventData.message}");
|
Debug.Log($"[HostConnection] Message from: {eventData.connectionId}, participantId: {eventData.participantId}, message: {eventData.message}");
|
||||||
|
|
||||||
foreach (var channel in streams.OfType<DataChannelBase>().Where(c => c.Label=="on-message"))
|
foreach (var channel in streams.OfType<DataChannelBase>().Where(c => c.Label=="on-message"))
|
||||||
{
|
{
|
||||||
if (channel != null)
|
if (channel != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user