From 2646ca107b5c2a14d571bad75ad08254ff5d2624 Mon Sep 17 00:00:00 2001 From: Clark Alesna Date: Mon, 13 Jul 2020 04:31:02 +0800 Subject: [PATCH 1/2] Added Nullchecks --- BlazorMedia.Demo/BlazorMedia.Demo.csproj.user | 9 ++++++ BlazorMedia.sln | 31 +++++++++++++++++++ BlazorMedia/BlazorMedia.csproj | 2 +- BlazorMedia/tsconfig.tsbuildinfo | 4 +-- BlazorMedia/wwwroot/BlazorMedia.js | 3 +- BlazorMedia/wwwroot/BlazorMedia.ts | 20 ++++++------ 6 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 BlazorMedia.Demo/BlazorMedia.Demo.csproj.user create mode 100644 BlazorMedia.sln diff --git a/BlazorMedia.Demo/BlazorMedia.Demo.csproj.user b/BlazorMedia.Demo/BlazorMedia.Demo.csproj.user new file mode 100644 index 0000000..7cca557 --- /dev/null +++ b/BlazorMedia.Demo/BlazorMedia.Demo.csproj.user @@ -0,0 +1,9 @@ + + + + ProjectDebugger + + + BlazorMedia.Demo + + \ No newline at end of file diff --git a/BlazorMedia.sln b/BlazorMedia.sln new file mode 100644 index 0000000..4bd3962 --- /dev/null +++ b/BlazorMedia.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30225.117 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorMedia", "BlazorMedia\BlazorMedia.csproj", "{2EF5949A-A495-4896-BC32-91FA57F92DD4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorMedia.Demo", "BlazorMedia.Demo\BlazorMedia.Demo.csproj", "{531F3F53-E031-477F-BAE5-0FCA1E8AEAF0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EF5949A-A495-4896-BC32-91FA57F92DD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EF5949A-A495-4896-BC32-91FA57F92DD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EF5949A-A495-4896-BC32-91FA57F92DD4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EF5949A-A495-4896-BC32-91FA57F92DD4}.Release|Any CPU.Build.0 = Release|Any CPU + {531F3F53-E031-477F-BAE5-0FCA1E8AEAF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {531F3F53-E031-477F-BAE5-0FCA1E8AEAF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {531F3F53-E031-477F-BAE5-0FCA1E8AEAF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {531F3F53-E031-477F-BAE5-0FCA1E8AEAF0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3FB8B58C-FDE4-47AB-AD98-28DAD32195D3} + EndGlobalSection +EndGlobal diff --git a/BlazorMedia/BlazorMedia.csproj b/BlazorMedia/BlazorMedia.csproj index 33f7a04..36d81a1 100644 --- a/BlazorMedia/BlazorMedia.csproj +++ b/BlazorMedia/BlazorMedia.csproj @@ -11,7 +11,7 @@ 8.0 3.0 true - 0.3.0.7 + 0.3.0.8 Rory Clark Manuelle Alesna, Nestor Angelo Tan true LICENSE.md diff --git a/BlazorMedia/tsconfig.tsbuildinfo b/BlazorMedia/tsconfig.tsbuildinfo index 4afd178..46b7d1c 100644 --- a/BlazorMedia/tsconfig.tsbuildinfo +++ b/BlazorMedia/tsconfig.tsbuildinfo @@ -62,8 +62,8 @@ "affectsGlobalScope": true }, "./wwwroot/blazormedia.ts": { - "version": "cf97729ababdae24740a06108ee38259e73e0a661fa50325f3d16da81770609c", - "signature": "b547b9d15246f3bd076b2a8ad8bd229790bced51876304a9703248924bd33aff", + "version": "7c3daa7058d7d82aae8a4e22750fd97b53e6e1a74a6ba83ca81eb9ba1d739266", + "signature": "b747948aaca5cafe9c2ae5fa00d7494c572247acfbe2ac066300c7cc9123bef9", "affectsGlobalScope": true }, "./node_modules/@types/dom-mediacapture-record/index.d.ts": { diff --git a/BlazorMedia/wwwroot/BlazorMedia.js b/BlazorMedia/wwwroot/BlazorMedia.js index 0f7a281..40bce36 100644 --- a/BlazorMedia/wwwroot/BlazorMedia.js +++ b/BlazorMedia/wwwroot/BlazorMedia.js @@ -238,11 +238,10 @@ var BlazorMedia; }; BlazorMediaInterop.HandleDeviceDisconnection = function (videoElement, componentRef) { return __awaiter(this, void 0, void 0, function () { - var tracks, devices, videoIsStillConnected, audioIsStillConnected, y, device, mediaError; + var devices, videoIsStillConnected, audioIsStillConnected, y, device, mediaError; return __generator(this, function (_a) { switch (_a.label) { case 0: - tracks = videoElement.mediaStream.getTracks(); if (!(videoElement.mediaStream && videoElement.mediaRecorder && videoElement.mediaRecorder.state != 'inactive')) return [3 /*break*/, 2]; return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()]; case 1: diff --git a/BlazorMedia/wwwroot/BlazorMedia.ts b/BlazorMedia/wwwroot/BlazorMedia.ts index 7ae3146..559a3ce 100644 --- a/BlazorMedia/wwwroot/BlazorMedia.ts +++ b/BlazorMedia/wwwroot/BlazorMedia.ts @@ -114,15 +114,17 @@ namespace BlazorMedia { } static async AddBlazorFPSListener(videoElement: BlazorMediaVideoElement, componentRef: any) { - videoElement.lastFPS = 0; - // FPS Counter - videoElement.fpsIntervalId = setInterval(() => { - if (videoElement) { - let frameRate = videoElement.getVideoPlaybackQuality().totalVideoFrames - videoElement.lastFPS; - videoElement.lastFPS = videoElement.getVideoPlaybackQuality().totalVideoFrames; - componentRef.invokeMethodAsync("ReceiveFPS", frameRate); - } - }, 1000); + if (videoElement) { + videoElement.lastFPS = 0; + // FPS Counter + videoElement.fpsIntervalId = setInterval(() => { + if (videoElement) { + let frameRate = videoElement.getVideoPlaybackQuality().totalVideoFrames - videoElement.lastFPS; + videoElement.lastFPS = videoElement.getVideoPlaybackQuality().totalVideoFrames; + componentRef.invokeMethodAsync("ReceiveFPS", frameRate); + } + }, 1000); + } } static async RemoveBlazorFPSListener(videoElement: BlazorMediaVideoElement) { From 9dfe45e34645b53d02cc774f2075797ce61458d1 Mon Sep 17 00:00:00 2001 From: Clark Alesna Date: Mon, 13 Jul 2020 04:40:53 +0800 Subject: [PATCH 2/2] Opsiee --- BlazorMedia/BlazorMedia.csproj | 2 +- BlazorMedia/tsconfig.tsbuildinfo | 2 +- BlazorMedia/wwwroot/BlazorMedia.js | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/BlazorMedia/BlazorMedia.csproj b/BlazorMedia/BlazorMedia.csproj index 36d81a1..fae8b85 100644 --- a/BlazorMedia/BlazorMedia.csproj +++ b/BlazorMedia/BlazorMedia.csproj @@ -11,7 +11,7 @@ 8.0 3.0 true - 0.3.0.8 + 0.3.0.9 Rory Clark Manuelle Alesna, Nestor Angelo Tan true LICENSE.md diff --git a/BlazorMedia/tsconfig.tsbuildinfo b/BlazorMedia/tsconfig.tsbuildinfo index 46b7d1c..8e16e38 100644 --- a/BlazorMedia/tsconfig.tsbuildinfo +++ b/BlazorMedia/tsconfig.tsbuildinfo @@ -62,7 +62,7 @@ "affectsGlobalScope": true }, "./wwwroot/blazormedia.ts": { - "version": "7c3daa7058d7d82aae8a4e22750fd97b53e6e1a74a6ba83ca81eb9ba1d739266", + "version": "d667c85e81a2d6dc88bad6dbdd27f6af5377095cde79d6b1098f1e2f9c7fb712", "signature": "b747948aaca5cafe9c2ae5fa00d7494c572247acfbe2ac066300c7cc9123bef9", "affectsGlobalScope": true }, diff --git a/BlazorMedia/wwwroot/BlazorMedia.js b/BlazorMedia/wwwroot/BlazorMedia.js index 40bce36..144d9f9 100644 --- a/BlazorMedia/wwwroot/BlazorMedia.js +++ b/BlazorMedia/wwwroot/BlazorMedia.js @@ -178,15 +178,17 @@ var BlazorMedia; BlazorMediaInterop.AddBlazorFPSListener = function (videoElement, componentRef) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { - videoElement.lastFPS = 0; - // FPS Counter - videoElement.fpsIntervalId = setInterval(function () { - if (videoElement) { - var frameRate = videoElement.getVideoPlaybackQuality().totalVideoFrames - videoElement.lastFPS; - videoElement.lastFPS = videoElement.getVideoPlaybackQuality().totalVideoFrames; - componentRef.invokeMethodAsync("ReceiveFPS", frameRate); - } - }, 1000); + if (videoElement) { + videoElement.lastFPS = 0; + // FPS Counter + videoElement.fpsIntervalId = setInterval(function () { + if (videoElement) { + var frameRate = videoElement.getVideoPlaybackQuality().totalVideoFrames - videoElement.lastFPS; + videoElement.lastFPS = videoElement.getVideoPlaybackQuality().totalVideoFrames; + componentRef.invokeMethodAsync("ReceiveFPS", frameRate); + } + }, 1000); + } return [2 /*return*/]; }); });