rdkcentral / Lightning-SDK

SDK for Lightning framework
Apache License 2.0
130 stars 69 forks source link

SDK - Img plugin error on rendering images #203

Closed NickLeDev closed 2 years ago

NickLeDev commented 3 years ago

Hello,

I'm a developer working on a Xfinity Comcast device project with the Lighning SDK and I have issues with the Img plugin. I'm using an endpoint for my lightning app to consume and it feeds a. lineup of items that have each an image to display. I read in your documentation that when it's from an Api I should use the Img plugin. Everything works fine in dev (latest Chrome) but when I go on the Comcast device I have only some images that are displaying. It's always the same every-time I reload.

Here's the error I get:

[Lightning] texture load error Image load error https://images.tou.tv/c_scale,w_223,h_125/v1/ici-tou-tv/promos/16x9/764baab2-2c66-6126-3855-369d9ffc053b.jpg-contain-375-210.9375

texture failed to load: https://images.tou.tv/c_scale,w_223,h_125/v1/ici-tou-tv/promos/16x9/764baab2-2c66-6126-3855-369d9ffc053b.jpg

As you can see there's something that is added at the end of the url in the first error (-contain-375-210.9375).

Like I said, I have this issues on around 95% of my images and the others are working properly.

Here's a bit of code inside my component Card that is using the Img plugin:

_init() {
        this.tag('Image').on('txLoaded', () => {
            console.log('texture loaded: ' + this.tag('Image').texture.src)
            this.tag('Image').setSmooth('alpha', 1)
        })

        this.tag('Image').on('txError', () => {
            console.error('texture failed to load: ' + this.tag('Image').texture.src)
        })

        this.tag('Image').on('txUnloaded', () => {
            console.log('texture unloaded!')
        })
    }

    _active() {
        this.tag('Image').patch({
            smooth: {
                alpha: 1,
            },
            texture: Img(this.image).cover(this.w, this.tag('Header').h),
        })
    }
erikhaandrikman commented 3 years ago

Hi, i'm not able to reproduce this. Is it possible to share SDK version?

_active(){
        this.tag('Image').patch({
            smooth: {
                alpha: 1,
            },
            texture: Img("https://images.tou.tv/c_scale,w_223,h_125/v1/ici-tou-tv/promos/16x9/764baab2-2c66-6126-3855-369d9ffc053b.jpg").cover(200,200)
        })
}

the above test is working as expected (tested SDK4.4.0)

erikhaandrikman commented 3 years ago

Can we close this issue?