简体   繁体   中英

How do I check if a fabric Object is a video?

Fabricjs seems to use fabric.Image to create both an image or a video. In multiple use cases if I'm getting some fabric object, through an event, or looping through the fabric canvas, I need to differentiate if that object is an image or a video. If I use fabricObject.type I will get "image" type for both the video object and the image object. Is there some other property I can check to determine which is which? Perhaps there is a way to add metaData to the fabric.Object to help differentiate objects.

Ok, so I found out that I can use the data field inside a fabric object to store any type of data I want, without fabric messing with it. This will help immensely and I've tested that it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM