Can animated GIFs display on the Glass timeline?

Using the Mirror API, can animated GIFs snap to the Glass timeline? If so, will they actually be animated on the glass or present as a static image?

+4
source share
2 answers

To answer the second question, gif animates. I tested with this timeline:

{ "kind": "mirror#timelineItem", "id": "6fd3c490-f751-40e3-8e1f-8b71494160fc", "created": "2013-05-28T20:05:23.589Z", "updated": "2013-05-28T20:05:23.589Z", "etag": "\"r3ghbVW9Rp1kDP4UexS05_pFx4E/jVAhcX1aYFm8-1tN5G5Fv6RSscQ\"", "html": "<article class=\"photo\">\n <img src=\"http://media.idownloadblog.com/wp-content/uploads/2012/05/Sonic-Animated.gif\" width=\"100%\" height=\"100%\">\n <div class=\"photo-overlay\"></div>\n <section>\n <p class=\"text-auto-size\">Spring Fling Fundraiser at Filoli</p>\n </section>\n</article>\n", "notification": { "level": "DEFAULT" } } 

And the gif comes to life on glass. It took some time to load a map with a typical gray image with text on top, but as soon as the image appeared, it certainly animated and looped. If you come back to him later, he still revives.

Update. You can activate the attached GIF using the new help from Jenny Murphy on the problem tracker. If you include very simple HTML that references the application (for example), it works and animates. I tested this with Glass using XE6.

This is the java code for this:

  TimelineItem timelineItem = new TimelineItem(); timelineItem.setText(""); timelineItem.setNotification(new NotificationConfig() .setLevel("DEFAULT")); //add html with reference to attachment using index 0 timelineItem.setHtml("<img src=\"attachment:0\">"); // Attach animated GIF String contentType = req.getParameter("contentType"); URL url = new URL(req.getParameter("imageUrl")); byte[] b = ByteStreams.toByteArray(url.openStream()); InputStream animatedGifStream = url.openStream(); MirrorClient.insertTimelineItem(credential, timelineItem, contentType, animatedGifStream); 

Fully working implementation of this: https://github.com/mscheel/mirror-quickstart-java

This is a starter project for Java with additional features for attaching a video or animated gif using an attachment.

+3
source

Animated GIFs work both as attachments and as <img> tags in HTML.

+5
source

Source: https://habr.com/ru/post/1483077/


All Articles