diff options
| author | yipstanley <stanley_yip@brown.edu> | 2019-03-17 14:23:00 -0400 |
|---|---|---|
| committer | yipstanley <stanley_yip@brown.edu> | 2019-03-17 14:23:00 -0400 |
| commit | 3d337129f112425345436aa69a95fcf03ad830d7 (patch) | |
| tree | f156445b8f5afad577e4038a849290d755a8d552 /src/fields/VideoField.ts | |
| parent | b4dc598ff08c7c684daa4b75508e17213d29d8e5 (diff) | |
| parent | 47da497aded0bafdc5c85c8a79a9a06d0d401e92 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into view_doc_impl
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 |
