add environment variable to set custom movie backend url

edit readme
handle enter event on AuthenticationPage
This commit is contained in:
2021-03-16 20:44:32 +01:00
parent e412f699f7
commit 5dbbd34d3a
3 changed files with 50 additions and 13 deletions

View File

@ -1,6 +1,7 @@
import React from 'react';
import {Button} from '../../elements/GPElements/Button';
import style from './AuthenticationPage.module.css';
import {addKeyHandler, removeKeyHandler} from '../../utils/ShortkeyHandler';
interface state {
pwdText: string;
@ -17,6 +18,16 @@ class AuthenticationPage extends React.Component<Props, state> {
this.state = {
pwdText: ''
};
this.keypress = this.keypress.bind(this);
}
componentDidMount(): void {
addKeyHandler(this.keypress);
}
componentWillUnmount(): void {
removeKeyHandler(this.keypress);
}
render(): JSX.Element {
@ -46,6 +57,20 @@ class AuthenticationPage extends React.Component<Props, state> {
</>
);
}
/**
* key event handling
* @param event keyevent
*/
keypress(event: KeyboardEvent): void {
// hide if escape is pressed
if (event.key === 'Enter') {
// call a parentsubmit if defined
if (this.props.submit) {
this.props.submit(this.state.pwdText);
}
}
}
}
export default AuthenticationPage;

View File

@ -280,12 +280,18 @@ export class Player extends React.Component<myprops, mystate> {
{action: 'loadVideo', MovieId: parseInt(this.props.match.params.id, 10)},
(result: VideoTypes.loadVideoType) => {
console.log(result);
console.log(process.env.REACT_APP_CUST_BACK_DOMAIN);
this.setState({
sources: {
type: 'video',
sources: [
{
src: getBackendDomain() + GlobalInfos.getVideoPath() + result.MovieUrl,
src:
(process.env.REACT_APP_CUST_BACK_DOMAIN
? process.env.REACT_APP_CUST_BACK_DOMAIN
: getBackendDomain()) +
GlobalInfos.getVideoPath() +
result.MovieUrl,
type: 'video/mp4',
size: 1080
}