Hi @Stefan,
I’m wanting to play snippets of videos (or just short videos) one after another without loading icons appearing. I started with something like this:
v1.video.onLoaded(()=>{
v1.video.play();
Time.schedule(()=>{
v1.video.stop();
v1.opacity = 0;
v2.opacity = 1;
v2.video.onLoaded(()=>{
v2.video.play();
Time.schedule(()=>{
v2.video.stop();
},2);
});
},2);
});
but this doesn’t play the 2nd video for some reason.
I tried implementing using a Promise, based on this Solution:
function play(item: VideoItem): Promise<BaseItem> {
return new Promise((resolve,reject)=>{
item.video.onLoaded(()=>{
item.opacity = 1;
item.video.play();
Time.schedule(()=>{
item.video.stop();
item.opacity = 0;
resolve(item);
},2);
})
})
}
play(v1)
.then(play(v2))
.then(play(v3));
but that fails at the first then() with the error:
Argument of type 'Promise<BaseItem>' is not assignable to parameter of type '(value: BaseItem) => BaseItem | PromiseLike<BaseItem>'.
Type 'Promise<BaseItem>' provides no match for the signature '(value: BaseItem): BaseItem | PromiseLike<BaseItem>'.(2345)
Any ideas of how to better implement this? I’ve got it working fine in CoBlocks, but there’s some lag between videos so trying to get it faster in JS/TS. See CoSpaces Edu :: Video editing test
Many thanks,
Geoff