Giter VIP home page Giter VIP logo

Comments (6)

Donaldcwl avatar Donaldcwl commented on August 15, 2024

Hi @HexMox ,
Do you still having this issue?

I just tested it on a IOS simulator(iPhone XS IOS 12.1) and it is working fine.
image

According to the can i use website, the OffscreenCanvas should be undefined in IOS safari.
https://caniuse.com/#feat=offscreencanvas

The "typeof OffscreenCanvas === 'function'" should evaluate as "false" and the code "document.createElement('canvas')" should be executed.

Would you mind to test it again to confirm the issue?

Thanks.

from browser-image-compression.

HexMox avatar HexMox commented on August 15, 2024

Hi Donaldcwl, Thanks for your reply.
There may be a few differences between iOS simulator and iPhone.
I added fallback logic which will reports some error messages when occurs unexpected error.

from browser-image-compression.

ccirene avatar ccirene commented on August 15, 2024

I have found this problem too. � and it only occurs on iphone x.
15_16_13__04_23_2019

from browser-image-compression.

Donaldcwl avatar Donaldcwl commented on August 15, 2024

@ccirene Since I don't have a physical iPhone X and simulator doesn't reproduce the issue, can you try to debug for me?

what is the value of following statements:

console.log('is function?', typeof OffscreenCanvas === 'function')
console.log('new works?', new OffscreenCanvas(10, 10))
console.log('getContext works?', (new OffscreenCanvas(10, 10)).getContext('2d'))
console.log('drawImage is function?', (new OffscreenCanvas(10, 10)).getContext('2d').drawImage)

Thanks!

from browser-image-compression.

ccirene avatar ccirene commented on August 15, 2024

HI, thank you for helping me.
It console.log as below.
"is function? true
new works? [object OffscreenCanvas]
getContext works? null
TypeError: null is not an object (evaluating 'new OffscreenCanvas(10,10).getContext("2d").drawImage')
"
it seems getContext('2d') doesn't work at iphone x

from browser-image-compression.

Donaldcwl avatar Donaldcwl commented on August 15, 2024

@ccirene Can you try this version of the library to see if it works on iPhone X?
browser-image-compression.zip

It seems that the problem is OffscreenCanvas.getContext('2d') return null on iPhone X which means this "2d" context identifier is not supported on iPhone X.

I am trying to fall back to HTMLCanvasElement (document.createElement('canvas')) instead.

from browser-image-compression.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.