diff options
| author | Brandon <brandon_li@brown.edu> | 2019-03-11 18:27:22 -0400 |
|---|---|---|
| committer | Brandon <brandon_li@brown.edu> | 2019-03-11 18:27:22 -0400 |
| commit | c1d2a28123f4c9290fe8346730976687671f4042 (patch) | |
| tree | 7d6ad3ca7c8216947ec7563963a55a5b9c39d848 /src/fields/VideoField.ts | |
| parent | c9ae6d447c151ffbc6691a095802489038d004c1 (diff) | |
| parent | 618e66a5a070f1aac9224bd3f44b76a5ac314bfa (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into kvp
Diffstat (limited to 'src/fields/VideoField.ts')
| -rw-r--r-- | src/fields/VideoField.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/fields/VideoField.ts b/src/fields/VideoField.ts new file mode 100644 index 000000000..5f4ae19bf --- /dev/null +++ b/src/fields/VideoField.ts @@ -0,0 +1,30 @@ +import { BasicField } from "./BasicField"; +import { Field, FieldId } from "./Field"; +import { Types } from "../server/Message"; + +export class VideoField extends BasicField<URL> { + constructor(data: URL | undefined = undefined, id?: FieldId, save: boolean = true) { + super(data == undefined ? new URL("http://techslides.com/demos/sample-videos/small.mp4") : data, save, id); + } + + toString(): string { + return this.Data.href; + } + + ToScriptString(): string { + return `new VideoField("${this.Data}")`; + } + + Copy(): Field { + return new VideoField(this.Data); + } + + ToJson(): { type: Types, data: URL, _id: string } { + return { + type: Types.Video, + data: this.Data, + _id: this.Id + } + } + +}
\ No newline at end of file |
