Skip to content

Commit

Permalink
Fix bug with video player
Browse files Browse the repository at this point in the history
  • Loading branch information
MetaverseUnknower committed Oct 18, 2024
1 parent a149c6d commit 47c498a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
26 changes: 24 additions & 2 deletions src/components/VLMVideo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/services/Video.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down Expand Up @@ -105,6 +105,8 @@ export class VideoService {
...videoOptions,
})

VLMDebug.log('video', 'setting video texture', textureOptions)

if (entity) {
this.setTexture(entity, textureOptions)
} else {
Expand Down

0 comments on commit 47c498a

Please sign in to comment.