diff --git a/app/assets/styles/blink/_ConferenceParticipant.scss b/app/assets/styles/blink/_ConferenceParticipant.scss index 29ca1f4..c8cce63 100644 --- a/app/assets/styles/blink/_ConferenceParticipant.scss +++ b/app/assets/styles/blink/_ConferenceParticipant.scss @@ -1,11 +1,17 @@ .container { flex: 1; + width: 120px; + height: 90px; + border-width: 1px; + border-radius: 5px; } .videoContainer { - + height: 100%; + width: 100%; } .video { - -} \ No newline at end of file + height: 100%; + width: 100%; +} diff --git a/app/components/ConferenceParticipant.js b/app/components/ConferenceParticipant.js index f5d1e29..66ac938 100644 --- a/app/components/ConferenceParticipant.js +++ b/app/components/ConferenceParticipant.js @@ -1,134 +1,134 @@ import React from 'react'; import PropTypes from 'prop-types'; // const hark = require('hark'); import { View } from 'react-native'; import classNames from 'classnames'; import autoBind from 'auto-bind'; import { IconButton } from 'react-native-paper'; import { RTCView } from 'react-native-webrtc'; import styles from '../assets/styles/blink/_ConferenceParticipant.scss'; class ConferenceParticipant extends React.Component { constructor(props) { super(props); autoBind(this); this.state = { active: false, hasVideo: false, overlayVisible: false, audioMuted: false, stream: null } this.speechEvents = null; this.videoElement = React.createRef(); props.participant.on('stateChanged', this.onParticipantStateChanged); } componentDidMount() { this.maybeAttachStream(); // this.videoElement.current.oncontextmenu = (e) => { // // disable right click for video elements // e.preventDefault(); // }; } componentWillUnmount() { //this.videoElement.current.pause(); this.props.participant.removeListener('stateChanged', this.onParticipantStateChanged); if (this.speechEvents !== null) { this.speechEvents.stop(); this.speechEvents = null; } } onParticipantStateChanged(oldState, newState) { if (newState === 'established') { this.maybeAttachStream(); } } onMuteAudioClicked(event) { event.preventDefault(); const streams = this.props.participant.streams; if (streams[0].getAudioTracks().length > 0) { const track = streams[0].getAudioTracks()[0]; if(this.state.audioMuted) { track.enabled = true; this.setState({audioMuted: false}); } else { track.enabled = false; this.setState({audioMuted: true}); } } } maybeAttachStream() { const streams = this.props.participant.streams; if (streams.length > 0) { this.setState({stream: streams[0], hasVideo: streams[0].getVideoTracks().length > 0}); // const options = { // interval: 150, // play: false // }; // this.speechEvents = hark(streams[0], options); // this.speechEvents.on('speaking', () => { // this.setState({active: true}); // }); // this.speechEvents.on('stopped_speaking', () => { // this.setState({active: false}); // }); } } showOverlay() { this.setState({overlayVisible: true}); } hideOverlay() { if (!this.state.audioMuted) { this.setState({overlayVisible: false}); } } render() { // const tooltip = ( // {this.props.participant.identity.displayName || this.props.participant.identity.uri} // ); const classes = classNames({ 'poster' : !this.state.hasVideo, 'conference-active' : this.state.active }); let muteButton; if (this.state.overlayVisible) { const muteButtonIcons = this.state.audioMuted ? 'microphone-off' : 'microphone'; muteButton = ( ); } return ( {muteButton} {/* */} - + {/* */} ); } } ConferenceParticipant.propTypes = { participant: PropTypes.object.isRequired }; export default ConferenceParticipant;