Bug 1642729 Comment 4 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I made a [prototype patch](https://github.com/ChunMinChang/gecko-dev/commit/15bc588893e25856ce79853a63503687361b7529) that works, by creating a temp image file (via `nsIFile`) and feed it to MPRIS.

I found that `"mpris:artUrl"` has some kind of cache mechanism, at least on Ubuntu 18.04:
1. The image shown on the notification bar won't be updated as long as the URL of the image is the same, even if the whole image file is overwritten/updated
2. Once the image URL is used, its image is cached. Even the original image is destroyed
    - For example,
        1. Open Firefox with a media element. The MPRIS would start automatically.
        2. Feed image _A_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_ 
        3. Feed image _B_ whose filename is `test-2.png` to `"mpris:artUrl"`, the MPRIS image will be image _B_
        4. Close Firefox
        5. Open Firefox with a media element again. The MPRIS would start automatically.
        6. Feed image _C_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_
           - What a surprise!
    - Therefore, it's better to create a unique image URL for each image. Now I use a timestamp as a unique identifier.
I worked out a [prototype](https://github.com/ChunMinChang/gecko-dev/commit/15bc588893e25856ce79853a63503687361b7529), by creating a temp image file (via `nsIFile`) and feed it to MPRIS.

I found that `"mpris:artUrl"` has some kind of cache mechanism, at least on Ubuntu 18.04:
1. The image shown on the notification bar won't be updated as long as the URL of the image is the same, even if the whole image file is overwritten/updated
2. Once the image URL is used, its image is cached. Even the original image is destroyed
    - For example,
        1. Open Firefox with a media element. The MPRIS would start automatically.
        2. Feed image _A_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_ 
        3. Feed image _B_ whose filename is `test-2.png` to `"mpris:artUrl"`, the MPRIS image will be image _B_
        4. Close Firefox
        5. Open Firefox with a media element again. The MPRIS would start automatically.
        6. Feed image _C_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_
           - What a surprise!
    - Therefore, it's better to create a unique image URL for each image. Now I use a timestamp as a unique identifier.
I worked out a [prototype](https://github.com/ChunMinChang/gecko-dev/commit/15bc588893e25856ce79853a63503687361b7529), by creating a temp image file (via `nsIFile`) and feed it to MPRIS. The patch is quite ugly now though.

I found that `"mpris:artUrl"` has some kind of cache mechanism, at least on Ubuntu 18.04:
1. The image shown on the notification bar won't be updated as long as the URL of the image is the same, even if the whole image file is overwritten/updated
2. Once the image URL is used, its image is cached. Even the original image is destroyed
    - For example,
        1. Open Firefox with a media element. The MPRIS would start automatically.
        2. Feed image _A_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_ 
        3. Feed image _B_ whose filename is `test-2.png` to `"mpris:artUrl"`, the MPRIS image will be image _B_
        4. Close Firefox
        5. Open Firefox with a media element again. The MPRIS would start automatically.
        6. Feed image _C_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_
           - What a surprise!
    - Therefore, it's better to create a unique image URL for each image. Now I use a timestamp as a unique identifier.
I worked out a [prototype](https://github.com/ChunMinChang/gecko-dev/commit/15bc588893e25856ce79853a63503687361b7529), by creating a temp image file (via `nsIFile`) and feed it to MPRIS. The patch is quite ugly now though.

I found that `"mpris:artUrl"` has some kind of cache mechanism, at least on Ubuntu 18.04:
1. The image shown on the notification bar won't be updated as long as the URL of the image is the same, even if the whole image file is overwritten/updated
2. Once the image URL is used, its image is cached. Even the original image is destroyed
    - For example,
        1. Open Firefox with a media element. The MPRIS would start automatically.
        2. Feed image _A_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_ 
        3. Feed image _B_ whose filename is `test-2.png` to `"mpris:artUrl"`, the MPRIS image will be image _B_
        4. Close Firefox
        5. Open Firefox with a media element again. The MPRIS would start automatically.
        6. Feed image _C_ whose filename is `test-1.png` to `"mpris:artUrl"`, the MPRIS image will be image _A_
           - What a surprise! I guess it's image _C_, but it's not!
    - Therefore, it's better to create a unique image URL for each image. Now I use a timestamp as a unique identifier.

Back to Bug 1642729 Comment 4