Improve mobile camera shown (#1354)
- Add new store to send mobile size - Update style to show video for mobile size
This commit is contained in:
parent
22a46a98ea
commit
c7fdfed00c
@ -7,6 +7,8 @@
|
|||||||
import {videoFocusStore} from "../../Stores/VideoFocusStore";
|
import {videoFocusStore} from "../../Stores/VideoFocusStore";
|
||||||
import {showReportScreenStore} from "../../Stores/ShowReportScreenStore";
|
import {showReportScreenStore} from "../../Stores/ShowReportScreenStore";
|
||||||
import {getColorByString, srcObject} from "./utils";
|
import {getColorByString, srcObject} from "./utils";
|
||||||
|
import {localStreamStore, obtainedMediaConstraintIsMobileStore} from "../../Stores/MediaStore";
|
||||||
|
import {onDestroy} from "svelte";
|
||||||
|
|
||||||
export let peer: VideoPeer;
|
export let peer: VideoPeer;
|
||||||
let streamStore = peer.streamStore;
|
let streamStore = peer.streamStore;
|
||||||
@ -18,6 +20,13 @@
|
|||||||
showReportScreenStore.set({ userId:peer.userId, userName: peer.userName });
|
showReportScreenStore.set({ userId:peer.userId, userName: peer.userName });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isMobile : boolean|null;
|
||||||
|
const unsubscribe = obtainedMediaConstraintIsMobileStore.subscribe(value => {
|
||||||
|
console.log('unsubscribe => obtainedMediaConstraintIsMobileStore', value);
|
||||||
|
isMobile = value;
|
||||||
|
});
|
||||||
|
onDestroy(unsubscribe);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="video-container">
|
<div class="video-container">
|
||||||
@ -37,7 +46,7 @@
|
|||||||
<img alt="Report this user" src={reportImg}>
|
<img alt="Report this user" src={reportImg}>
|
||||||
<span>Report/Block</span>
|
<span>Report/Block</span>
|
||||||
</button>
|
</button>
|
||||||
<video use:srcObject={$streamStore} autoplay playsinline on:click={() => videoFocusStore.toggleFocus(peer)}></video>
|
<video class:mobile="{isMobile === true}" use:srcObject={$streamStore} autoplay playsinline on:click={() => videoFocusStore.toggleFocus(peer)}></video>
|
||||||
<img src={blockSignImg} class="block-logo" alt="Block" />
|
<img src={blockSignImg} class="block-logo" alt="Block" />
|
||||||
{#if $constraintStore && $constraintStore.audio !== false}
|
{#if $constraintStore && $constraintStore.audio !== false}
|
||||||
<SoundMeterWidget stream={$streamStore}></SoundMeterWidget>
|
<SoundMeterWidget stream={$streamStore}></SoundMeterWidget>
|
||||||
|
@ -576,3 +576,8 @@ localStreamStore.subscribe((streamResult) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A store containing the real active media is mobile
|
||||||
|
*/
|
||||||
|
export const obtainedMediaConstraintIsMobileStore = writable(false);
|
||||||
|
@ -5,6 +5,7 @@ import type { UserSimplePeerInterface } from "./SimplePeer";
|
|||||||
import { Readable, readable } from "svelte/store";
|
import { Readable, readable } from "svelte/store";
|
||||||
import { videoFocusStore } from "../Stores/VideoFocusStore";
|
import { videoFocusStore } from "../Stores/VideoFocusStore";
|
||||||
import { getIceServersConfig } from "../Components/Video/utils";
|
import { getIceServersConfig } from "../Components/Video/utils";
|
||||||
|
import { isMobile } from "../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
const Peer: SimplePeerNamespace.SimplePeer = require("simple-peer");
|
const Peer: SimplePeerNamespace.SimplePeer = require("simple-peer");
|
||||||
|
|
||||||
@ -175,6 +176,8 @@ export class ScreenSharingPeer extends Peer {
|
|||||||
|
|
||||||
public stopPushingScreenSharingToRemoteUser(stream: MediaStream) {
|
public stopPushingScreenSharingToRemoteUser(stream: MediaStream) {
|
||||||
this.removeStream(stream);
|
this.removeStream(stream);
|
||||||
this.write(new Buffer(JSON.stringify({ type: MESSAGE_TYPE_CONSTRAINT, streamEnded: true })));
|
this.write(
|
||||||
|
new Buffer(JSON.stringify({ type: MESSAGE_TYPE_CONSTRAINT, streamEnded: true, isMobile: isMobile() }))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import { screenSharingLocalStreamStore } from "../Stores/ScreenSharingStore";
|
|||||||
import { discussionManager } from "./DiscussionManager";
|
import { discussionManager } from "./DiscussionManager";
|
||||||
import { playersStore } from "../Stores/PlayersStore";
|
import { playersStore } from "../Stores/PlayersStore";
|
||||||
import { newChatMessageStore } from "../Stores/ChatStore";
|
import { newChatMessageStore } from "../Stores/ChatStore";
|
||||||
|
import { isMobile } from "../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
export interface UserSimplePeerInterface {
|
export interface UserSimplePeerInterface {
|
||||||
userId: number;
|
userId: number;
|
||||||
@ -391,7 +392,13 @@ export class SimplePeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PeerConnection.write(
|
PeerConnection.write(
|
||||||
new Buffer(JSON.stringify({ type: MESSAGE_TYPE_CONSTRAINT, ...streamResult.constraints }))
|
new Buffer(
|
||||||
|
JSON.stringify({
|
||||||
|
type: MESSAGE_TYPE_CONSTRAINT,
|
||||||
|
...streamResult.constraints,
|
||||||
|
isMobile: isMobile(),
|
||||||
|
})
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (streamResult.type === "error") {
|
if (streamResult.type === "error") {
|
||||||
|
@ -5,10 +5,11 @@ import { blackListManager } from "./BlackListManager";
|
|||||||
import type { Subscription } from "rxjs";
|
import type { Subscription } from "rxjs";
|
||||||
import type { UserSimplePeerInterface } from "./SimplePeer";
|
import type { UserSimplePeerInterface } from "./SimplePeer";
|
||||||
import { get, readable, Readable, Unsubscriber } from "svelte/store";
|
import { get, readable, Readable, Unsubscriber } from "svelte/store";
|
||||||
import { obtainedMediaConstraintStore } from "../Stores/MediaStore";
|
import { obtainedMediaConstraintIsMobileStore, obtainedMediaConstraintStore } from "../Stores/MediaStore";
|
||||||
import { playersStore } from "../Stores/PlayersStore";
|
import { playersStore } from "../Stores/PlayersStore";
|
||||||
import { chatMessagesStore, chatVisibilityStore, newChatMessageStore } from "../Stores/ChatStore";
|
import { chatMessagesStore, chatVisibilityStore, newChatMessageStore } from "../Stores/ChatStore";
|
||||||
import { getIceServersConfig } from "../Components/Video/utils";
|
import { getIceServersConfig } from "../Components/Video/utils";
|
||||||
|
import { isMobile } from "../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
const Peer: SimplePeerNamespace.SimplePeer = require("simple-peer");
|
const Peer: SimplePeerNamespace.SimplePeer = require("simple-peer");
|
||||||
|
|
||||||
@ -167,6 +168,9 @@ export class VideoPeer extends Peer {
|
|||||||
} else {
|
} else {
|
||||||
mediaManager.disabledVideoByUserId(this.userId);
|
mediaManager.disabledVideoByUserId(this.userId);
|
||||||
}
|
}
|
||||||
|
if (message.isMobile != undefined) {
|
||||||
|
obtainedMediaConstraintIsMobileStore.set(message.isMobile);
|
||||||
|
}
|
||||||
} else if (message.type === MESSAGE_TYPE_MESSAGE) {
|
} else if (message.type === MESSAGE_TYPE_MESSAGE) {
|
||||||
if (!blackListManager.isBlackListed(this.userUuid)) {
|
if (!blackListManager.isBlackListed(this.userUuid)) {
|
||||||
chatMessagesStore.addExternalMessage(this.userId, message.message);
|
chatMessagesStore.addExternalMessage(this.userId, message.message);
|
||||||
@ -281,7 +285,13 @@ export class VideoPeer extends Peer {
|
|||||||
private pushVideoToRemoteUser(localStream: MediaStream | null) {
|
private pushVideoToRemoteUser(localStream: MediaStream | null) {
|
||||||
try {
|
try {
|
||||||
this.write(
|
this.write(
|
||||||
new Buffer(JSON.stringify({ type: MESSAGE_TYPE_CONSTRAINT, ...get(obtainedMediaConstraintStore) }))
|
new Buffer(
|
||||||
|
JSON.stringify({
|
||||||
|
type: MESSAGE_TYPE_CONSTRAINT,
|
||||||
|
...get(obtainedMediaConstraintStore),
|
||||||
|
isMobile: isMobile(),
|
||||||
|
})
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!localStream) {
|
if (!localStream) {
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
height: 80%;
|
height: 80%;
|
||||||
|
|
||||||
&> div {
|
&> div {
|
||||||
max-height: 120px;
|
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
|
max-height: 21vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-container{
|
.video-container{
|
||||||
|
@ -47,6 +47,11 @@ body .message-info.warning{
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
cursor: url('./images/cursor_pointer.png'), pointer;
|
cursor: url('./images/cursor_pointer.png'), pointer;
|
||||||
|
|
||||||
|
&.mobile{
|
||||||
|
width: 100%;
|
||||||
|
height: 21vh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i {
|
i {
|
||||||
|
Loading…
Reference in New Issue
Block a user