tav-media
Version:
Cross platform media editing framework
65 lines (64 loc) • 2.3 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { Clip } from './tav-clip';
/**
* FakeClip is used to reference a snapshot of a composition in other effects.
* Call `someComposition.MakeFakeClip()` to create a fake clip.
* @hideconstructor
* @category Clips
*/
export class FakeClip extends Clip {
constructor() {
super(...arguments);
this.type = 'FakeClip';
}
release() {
this.nativeClip = null;
this.ontology.removeFakeClip(this);
}
build() {
return __awaiter(this, void 0, void 0, function* () {
const clip = yield this.createClip();
if (!clip)
return undefined;
this._nativeObject = clip;
this.nativeInvalidated = false;
return clip;
});
}
createClip() {
return __awaiter(this, void 0, void 0, function* () {
if (!this._ontology) {
return null;
}
if (!this._ontology.nativeClip || this._ontology.nativeInvalidated) {
this._ontology.noticeFakeClipsUpdate(this);
yield this._ontology.build();
}
const nativeClip = yield this._ontology.nativeClip.clone();
return nativeClip;
});
}
hasFakeClipNativeInvalidated() {
return this._ontology.nativeInvalidated || this.nativeInvalidated;
}
setNativeInvalidated() {
this.invalidated();
;
}
updateClip() {
return __awaiter(this, void 0, void 0, function* () {
return null;
});
}
set ontology(_target) {
this._ontology = _target;
}
}