react-native-theoplayer
Version:
A THEOplayer video component for react-native.
41 lines (40 loc) • 1.22 kB
JavaScript
;
import { DefaultEventDispatcher } from '../adapter/event/DefaultEventDispatcher';
import { NativeModules } from 'react-native';
import { fromNativeCachingTaskParameters } from './NativeCachingTaskParametersAdapter';
const NativeCacheModule = NativeModules.THEORCTCacheModule;
export class NativeCachingTaskAdapter extends DefaultEventDispatcher {
constructor(task) {
super();
this.bytes = task.bytes;
this.cached = {
...task.cached
};
this.duration = task.duration;
this.id = task.id;
this.bytesCached = task.bytesCached;
this.license = {
renew(drmConfiguration) {
NativeCacheModule.renewLicense(task.id, drmConfiguration);
}
};
this.parameters = fromNativeCachingTaskParameters(task.parameters);
this.percentageCached = task.percentageCached;
this.secondsCached = task.secondsCached;
// TODO!
this.source = {
...task.source
};
this.status = task.status;
}
pause() {
NativeCacheModule.pauseCachingTask(this.id);
}
remove() {
NativeCacheModule.removeCachingTask(this.id);
}
start() {
NativeCacheModule.startCachingTask(this.id);
}
}
//# sourceMappingURL=NativeCachingTaskAdapter.js.map