-
Notifications
You must be signed in to change notification settings - Fork 503
issue/8608 #2806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue/8608 #2806
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -304,21 +304,7 @@ class MediaPipeUtils { | |||||||||
| } | ||||||||||
| this.sourceTarget = target; | ||||||||||
| try { | ||||||||||
| const isMobile = typeof window.orientation !== 'undefined'; | ||||||||||
| const isPortrait = isMobile && window.screen.orientation.type.includes('portrait'); | ||||||||||
| const width = isPortrait ? this.VIDEO_HEIGHT: this.VIDEO_WIDTH; | ||||||||||
| const height = isPortrait ? this.VIDEO_WIDTH: this.VIDEO_HEIGHT; | ||||||||||
| const stream = await navigator.mediaDevices.getUserMedia({ | ||||||||||
| audio: false, | ||||||||||
| video: { | ||||||||||
| deviceId: { | ||||||||||
| exact: inputSource[1], | ||||||||||
| }, | ||||||||||
| width, | ||||||||||
| height, | ||||||||||
| }, | ||||||||||
| }); | ||||||||||
| this.stream = stream; | ||||||||||
| this.stream = await this.getVideoStream(inputSource[1]); | ||||||||||
| this.video.srcObject = this.stream; | ||||||||||
| this.video.width = this.VIDEO_WIDTH; | ||||||||||
| this.video.height = this.VIDEO_HEIGHT; | ||||||||||
|
|
@@ -379,22 +365,38 @@ class MediaPipeUtils { | |||||||||
| this.setForceFlipState(this.flipState, 0); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| async getVideoStream(source: string) { | ||||||||||
| const isMobile = typeof window.orientation !== 'undefined'; | ||||||||||
| const isPortrait = isMobile && window.screen.orientation.type.includes('portrait'); | ||||||||||
| const width = isPortrait ? this.VIDEO_HEIGHT: this.VIDEO_WIDTH; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| const height = isPortrait ? this.VIDEO_WIDTH: this.VIDEO_HEIGHT; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| return await navigator.mediaDevices.getUserMedia({ | ||||||||||
| video: { | ||||||||||
| deviceId: { exact: source }, | ||||||||||
| width, | ||||||||||
| height, | ||||||||||
| }, | ||||||||||
| }); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| registerRotateEvent = () => { | ||||||||||
| const isMobile = typeof window.orientation !== 'undefined'; | ||||||||||
| const reloadVideo = async () => { | ||||||||||
| const target = this.sourceTarget || 0; | ||||||||||
| const stream = await this.getVideoStream(this.videoInputList[target][1]); | ||||||||||
| this.video.srcObject = stream; | ||||||||||
| this.stream = stream; | ||||||||||
| }; | ||||||||||
| if (isMobile && !window.screen.orientation.onchange) { | ||||||||||
| window.screen.orientation.onchange = reloadVideo; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Suggested change
|
||||||||||
|
|
||||||||||
| async turnOnWebcam() { | ||||||||||
| let stream; | ||||||||||
| try { | ||||||||||
| const target = this.sourceTarget || 0; | ||||||||||
|
|
||||||||||
| const isMobile = typeof window.orientation !== 'undefined'; | ||||||||||
| const isPortrait = isMobile && window.screen.orientation.type.includes('portrait'); | ||||||||||
| const width = isPortrait ? this.VIDEO_HEIGHT: this.VIDEO_WIDTH; | ||||||||||
| const height = isPortrait ? this.VIDEO_WIDTH: this.VIDEO_HEIGHT; | ||||||||||
| stream = await navigator.mediaDevices.getUserMedia({ | ||||||||||
| video: { | ||||||||||
| deviceId: { exact: this.videoInputList[target][1] }, | ||||||||||
| width, | ||||||||||
| height, | ||||||||||
| }, | ||||||||||
| }); | ||||||||||
| stream = await this.getVideoStream(this.videoInputList[target][1]); | ||||||||||
| } catch (err) { | ||||||||||
| throw new Entry.Utils.IncompatibleError('IncompatibleError', [ | ||||||||||
| Lang.Workspace.check_webcam_error, | ||||||||||
|
|
@@ -404,6 +406,7 @@ class MediaPipeUtils { | |||||||||
| this.stream = stream; | ||||||||||
| try { | ||||||||||
| await this.video.play(); | ||||||||||
| this.registerRotateEvent(); | ||||||||||
| } catch {} | ||||||||||
| GEHelper.drawVideoElement(this.canvasVideo); | ||||||||||
| this.overlayCanvases.forEach((canvas: PIXI.Sprite | createjs.Bitmap) => { | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert
·