Skip to content

Commit

Permalink
Support landacape & portrait mode for manual device session
Browse files Browse the repository at this point in the history
  • Loading branch information
sudharsan-selvaraj committed Apr 14, 2024
1 parent 989b620 commit 75ad47f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/modules
4 changes: 2 additions & 2 deletions web/src/components/streaming/AndroidStream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function AndroidStream() {
containerElement.current &&
videoElement.current
) {
videoElement.current.style.height = height + 'px';
//videoElement.current.style.width = width + 'px';
interactionHandler = new SimpleInterationHandler(
videoElement.current as any,
canvasElement.current,
Expand Down Expand Up @@ -156,7 +156,7 @@ function AndroidStream() {
style={{
maxHeight: MAX_HEIGHT + 'px',
maxWidth: MAX_WIDTH + 'px',
width: 'auto',
height: 'auto!important',
position: 'absolute',
}}
src={imageSrc}
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/streaming/ios-stream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import DeviceLoading from '../../assets/device-loading.gif';
import useWebSocket from 'react-use-websocket';
import { StreamActionNotifier } from './StreamActionNotifier.tsx';

const MAX_HEIGHT = 720;
const MAX_WIDTH = 720;
const MAX_HEIGHT = 820;
const MAX_WIDTH = 820;

function IOSStream() {
const getParamsFromUrl = () => {
Expand Down Expand Up @@ -67,7 +67,7 @@ function IOSStream() {
containerElement.current &&
videoElement.current
) {
videoElement.current.style.height = height + 'px';
//videoElement.current.style.width = width + 'px';
interactionHandler = new SimpleInterationHandler(
videoElement.current as any,
canvasElement.current,
Expand Down Expand Up @@ -103,7 +103,7 @@ function IOSStream() {
style={{
maxHeight: MAX_HEIGHT + 'px',
maxWidth: MAX_WIDTH + 'px',
width: 'auto',
height: 'auto!important',
position: 'absolute',
backgroundImage: `url(${DeviceLoading})`,
backgroundRepeat: 'no-repeat',
Expand Down
8 changes: 6 additions & 2 deletions web/src/libs/simple-interation-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class SimpleInterationHandler {
private scaleRatio!: number;
private clickStartTime!: number;

constructor(
constructor(
private videoElement: HTMLElement,
touchableElement: HTMLCanvasElement,
containerElement: HTMLDivElement,
Expand Down Expand Up @@ -58,7 +58,11 @@ export class SimpleInterationHandler {
this.mouseDownPoint?.y != this.mouseUpPoint?.y
) {
//swipe action
const message = new SwipeControlMessage(this.mouseDownPoint as any, this.mouseUpPoint, Math.ceil(clickEndTime - this.clickStartTime));
const message = new SwipeControlMessage(
this.mouseDownPoint as any,
this.mouseUpPoint,
Math.ceil(clickEndTime - this.clickStartTime),
);
this.controlMessageSender.send(JSON.stringify(message.toJSON()));
console.log(message.toJSON());
return;
Expand Down

0 comments on commit 75ad47f

Please sign in to comment.