Skip to content

Commit 61d408a

Browse files
authored
v1.4.0 (#23)
1 parent 486401d commit 61d408a

File tree

9 files changed

+42
-29
lines changed

9 files changed

+42
-29
lines changed

Bridge~/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@livekit/livekit-unity",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "LiveKit Unity Bridge for WebGL",
55
"main": "./dist/index.js",
66
"source": "./src/index.ts",
@@ -20,7 +20,7 @@
2020
"author": "",
2121
"license": "ISC",
2222
"dependencies": {
23-
"livekit-client": "^1.3.0",
23+
"livekit-client": "^1.6.3",
2424
"typed-emitter": "^2.1.0"
2525
},
2626
"devDependencies": {

Bridge~/yarn.lock

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,10 @@ kind-of@^6.0.2:
583583
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
584584
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
585585

586-
livekit-client@^1.3.0:
587-
version "1.3.0"
588-
resolved "https://registry.yarnpkg.com/livekit-client/-/livekit-client-1.3.0.tgz#c728f10cb6c9e553db87e04050a05e453714c8c9"
589-
integrity sha512-Ls3ADbc2fVFDTOxjVkbBbLAxzhXh0DYJa+uWaTFOviyiV5gK6/rW3Sp9x5RSJfu7IbZqD+wg8VghiXCgNmNAxQ==
586+
livekit-client@^1.6.3:
587+
version "1.6.3"
588+
resolved "https://registry.yarnpkg.com/livekit-client/-/livekit-client-1.6.3.tgz#4ff46f1fbdaaa7982c339738964d18e8b43fd3d5"
589+
integrity sha512-hnVN/rQ9pVWK0L1lemLSOzBI6IXoJepgHP/USqmGJ6eucaoLMx1jK0iMWpR5T2/pg97GmZaUaRSUcXlELNSsoA==
590590
dependencies:
591591
async-await-queue "^1.2.1"
592592
events "^3.3.0"
@@ -595,6 +595,7 @@ livekit-client@^1.3.0:
595595
sdp-transform "^2.14.1"
596596
ts-debounce "^4.0.0"
597597
typed-emitter "^2.1.0"
598+
ua-parser-js "^1.0.2"
598599
webrtc-adapter "^8.1.1"
599600

600601
loader-runner@^4.2.0:
@@ -931,6 +932,11 @@ typescript@^4.5.5:
931932
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d"
932933
integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==
933934

935+
ua-parser-js@^1.0.2:
936+
version "1.0.33"
937+
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.33.tgz#f21f01233e90e7ed0f059ceab46eb190ff17f8f4"
938+
integrity sha512-RqshF7TPTE0XLYAqmjlu5cLLuGdKrNu9O1KLA/qp39QtbZwuzwv1dT46DZSopoUMsYgXpB3Cv8a03FI8b74oFQ==
939+
934940
uri-js@^4.2.2:
935941
version "4.4.1"
936942
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"

Runtime/Plugins/livekit-bridge.jslib

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,23 @@ var NativeLib = {
307307
AttachVideo: function (videoPtr, texId) {
308308
var tex = GL.textures[texId];
309309
var lastTime = -1;
310-
310+
311+
var initialVideo = LKBridge.Data.get(videoPtr);
312+
initialVideo.style.opacity = 0;
313+
initialVideo.style.width = 0;
314+
initialVideo.style.height = 0;
315+
document.body.appendChild(initialVideo);
316+
311317
var updateVideo = function () {
312318
var video = LKBridge.Data.get(videoPtr);
313-
if (video === undefined)
319+
if (video === undefined) {
320+
initialVideo.remove();
314321
return;
322+
}
315323

316324
var time = video.currentTime;
317325
if (!video.paused && video.srcObject !== null && time !== lastTime) {
318326
lastTime = time;
319-
320327
GLctx.bindTexture(GLctx.TEXTURE_2D, tex);
321328

322329
// Flip Y

Runtime/Plugins/livekit-client.jspre

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Scripts/Internal/HTMLVideoElement.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ public int VideoWidth
1313
get
1414
{
1515
JSNative.PushString("videoWidth");
16-
return (int) JSNative.GetNumber(JSNative.GetProperty(NativeHandle));
16+
return (int)JSNative.GetNumber(JSNative.GetProperty(NativeHandle));
1717
}
1818
}
19-
19+
2020
public int VideoHeight
2121
{
2222
get
2323
{
2424
JSNative.PushString("videoHeight");
25-
return (int) JSNative.GetNumber(JSNative.GetProperty(NativeHandle));
25+
return (int)JSNative.GetNumber(JSNative.GetProperty(NativeHandle));
2626
}
2727
}
28-
28+
2929
[MonoPInvokeCallback(typeof(JSNative.JSDelegate))]
3030
private static void ResizeEvent(IntPtr ptr)
3131
{
@@ -34,13 +34,13 @@ private static void ResizeEvent(IntPtr ptr)
3434
var handle = new JSHandle(ptr, true);
3535
if (!JSNative.IsObject(handle))
3636
return;
37-
37+
3838
var el = Acquire<HTMLVideoElement>(handle);
3939
Log.Debug($"Received HTMLVideoElement.Resize {el.VideoWidth}x{el.VideoHeight}");
4040

4141
if (el.VideoWidth == 0 || el.VideoHeight == 0)
4242
Debug.LogError($"HTMLVideoElement.Resize - Wrong size: {el.VideoWidth}*{el.VideoHeight}");
43-
43+
4444
el.SetupTexture();
4545
el.VideoReceived?.Invoke(el.Texture);
4646
}
@@ -49,10 +49,10 @@ private static void ResizeEvent(IntPtr ptr)
4949
Log.Error($"Error happened on HTMLVideoElement.VideoReceived ( Is your listeners working correctly ? ): {Environment.NewLine} {e.Message}");
5050
}
5151
}
52-
52+
5353
public delegate void VideoReceivedDelegate(Texture2D tex);
5454
public event VideoReceivedDelegate VideoReceived;
55-
55+
5656
public Texture2D Texture { get; private set; }
5757
private readonly int m_TextureId;
5858

@@ -76,8 +76,8 @@ void SetupTexture()
7676
{
7777
if (Texture != null)
7878
Object.Destroy(Texture);
79-
80-
Texture = Texture2D.CreateExternalTexture(VideoWidth, VideoHeight, TextureFormat.RGBA32, false, true, (IntPtr) m_TextureId);
79+
80+
Texture = Texture2D.CreateExternalTexture(VideoWidth, VideoHeight, TextureFormat.RGBA32, false, true, (IntPtr)m_TextureId);
8181
}
8282
}
83-
}
83+
};

Runtime/Scripts/Options.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ public struct RoomConnectOptions
5050
[JsonProperty("publishOnly")]
5151
public string PublishOnly;
5252
}
53-
}
53+
}

Runtime/Scripts/Room/Track/LocalTrack.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public string GetId()
2323

2424
return JSNative.GetStruct<TrackDimensions>(ptr);
2525
}
26-
26+
2727
public DeviceIdPromise GetDeviceId()
2828
{
2929
return Acquire<DeviceIdPromise>(JSNative.CallMethod(NativeHandle, "getDeviceId"));
@@ -49,12 +49,12 @@ internal DeviceIdPromise(JSHandle handle) : base(handle)
4949
{
5050

5151
}
52-
53-
protected virtual void OnResolve()
52+
53+
protected override void OnResolve()
5454
{
5555
base.OnResolve();
5656
if (!JSNative.IsUndefined(ResolveHandle))
5757
DeviceId = JSNative.GetString(ResolveHandle);
5858
}
5959
}
60-
}
60+
}

Samples~/JSExample/JSPackage~/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"@livekit/livekit-unity": "^0.0.4"
12+
"@livekit/livekit-unity": "^1.4.0"
1313
},
1414
"devDependencies": {
1515
"ts-loader": "^9.2.7",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "io.livekit.unity",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"displayName": "LiveKit WebGL SDK",
55
"description": "LiveKit Unity Bridge for WebGL",
66
"unity": "2021.3",
@@ -19,4 +19,4 @@
1919
"dependencies": {
2020
"com.unity.nuget.newtonsoft-json": "2.0.0"
2121
}
22-
}
22+
}

0 commit comments

Comments
 (0)