diff --git a/package.json b/package.json index 36276e2..bfdf9e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vlm-dcl", - "version": "1.0.0-alpha.50", + "version": "1.0.0-alpha.61", "description": "Virtual Land Manager for Decentraland SDK7", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/components/VLMVideo.component.ts b/src/components/VLMVideo.component.ts index ea8bc93..c96b0da 100644 --- a/src/components/VLMVideo.component.ts +++ b/src/components/VLMVideo.component.ts @@ -355,7 +355,10 @@ export namespace VLMVideo { startLiveStream: CallableFunction = () => { if (this.liveSrc) { this.videoOptions.src = this.liveSrc - this.services.video.setPlayer(null, this.videoOptions) + + this.instanceIds.forEach((instanceId: string) => { + instances[instanceId].startLiveStream() + }) } else { VLMDebug.log('error', 'Tried to start live stream but no url was provided') } @@ -386,7 +389,7 @@ export namespace VLMVideo { showOffImage: CallableFunction = () => { this.services.video.clearEventSystem() this.services.video.clear() - this.services.material.buildOptions({ textureSrc: this.offImageSrc, emission: this.emission }) + this.textureOptions = this.services.material.buildOptions({ textureSrc: this.offImageSrc, emission: this.emission }) this.services.video.setAllImageTextures(this) VLMDebug.log('showing off image', this.textureOptions) } @@ -444,6 +447,8 @@ export namespace VLMVideo { config.services.video.addEntity(this.entity) + // this.updateTextureOptions(config.textureOptions) + if (config.mediaType === DynamicMediaType.LIVE) { config.startLiveStream() } else if (config.mediaType === DynamicMediaType.PLAYLIST) { @@ -521,6 +526,23 @@ export namespace VLMVideo { config.services.video.setPlayer(this.entity, config.videoOptions) } + + /** + * @public startLiveStream + * Starts a video in the playlist + * @returns void + */ + startLiveStream: CallableFunction = () => { + const config = configs[this.configId] + + if (config.liveSrc) { + config.videoOptions.src = config.liveSrc + config.textureOptions = config.services.material.buildOptions({ emission: config.emission }) + config.services.video.setPlayer(this.entity, config.videoOptions, config.textureOptions) + } else { + VLMDebug.log('error', 'Tried to start live stream but no url was provided') + } + } /** * @public updateTransform * Updates the instance's transform diff --git a/src/services/Video.service.ts b/src/services/Video.service.ts index e83f49d..cd2000e 100644 --- a/src/services/Video.service.ts +++ b/src/services/Video.service.ts @@ -69,7 +69,7 @@ export class VideoService { specularIntensity: 0, metallic: 0, emissiveTexture: this.videoTexture, - emissiveIntensity: 0.6, + emissiveIntensity: textureOptions?.emissiveIntensity || 1, emissiveColor: Color3.White(), } VLMDebug.log('setting texture', { @@ -105,6 +105,8 @@ export class VideoService { ...videoOptions, }) + VLMDebug.log('video', 'setting video texture', textureOptions) + if (entity) { this.setTexture(entity, textureOptions) } else {