blob: 6daf15f5f64f87f5d6450e1d9b94168aa47c5e09 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 | import React = require("react")
import { FieldViewProps, FieldView } from './FieldView';
import { FieldWaiting } from '../../../fields/Field';
import { observer } from "mobx-react"
import { ContextMenu } from "../../views/ContextMenu";
import { observable, action } from 'mobx';
import { KeyStore } from '../../../fields/KeyStore';
import { AudioField } from "../../../fields/AudioField";
import "./AudioBox.scss"
import { NumberField } from "../../../fields/NumberField";
@observer
export class AudioBox extends React.Component<FieldViewProps> {
    public static LayoutString() { return FieldView.LayoutString(AudioBox) }
    constructor(props: FieldViewProps) {
        super(props);
    }
    componentDidMount() {
    }
    componentWillUnmount() {
    }
    render() {
        let field = this.props.doc.Get(this.props.fieldKey)
        let path = field == FieldWaiting ? "http://techslides.com/demos/samples/sample.mp3" :
            field instanceof AudioField ? field.Data.href : "http://techslides.com/demos/samples/sample.mp3";
        return (
            <div>
                <audio controls className="audiobox-cont">
                    <source src={path} type="audio/mpeg" />
                    Not supported.
                </audio>
            </div>
        )
    }
}
 |