Fixed Stretched video and image thumbnail preview on mobile devices

Moshe1010

Well-known member
Affected version
2.2.10 Patch 1
It seems that If an image or video has lower than expected dimensions/resolution, the preview thumbnail (before playing the video for example) is starched and looks quite awful on mobile devices. Tested with iPhone 14 Pro, iOS 16.0.2.

Example is here:

9C04C63C-1895-4F5E-A434-A82F988B2690.jpeg

Could also be seen here:

9C7DC74D-4043-4997-AE1D-9CF28A20DECC.jpeg
 
Last edited:
I think this is caused by XF.VideoInit.hasSeeked()

JavaScript:
const width = this.target.offsetWidth
const height = this.target.offsetHeight
const canvas = XF.createElement('canvas', {
    width: width,
    height: height
})
const context = canvas.getContext('2d')

context.drawImage(this.video, 0, 0, width, height)

This draws the video to a canvas that has the size of the target element which is always landscape.
So if the video is in portrait mode, this will most likely significantly stretch the image to fit the canvas.
 
Last edited:
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.7).

Change log:
Fix manual video thumbnail generation on iOS
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom