Dealing with images/videos in shared 'forum'

Hi All,

Fantastic workshop today, everyone! As always! I currently have a thread open with an existing conundrum and would really appreciate some help! But after the workshop, I’ve come up with another.

Using an example from my existing thread:

I have a Quest here that has a questStatus characteristic. But what if questStatus could also be an image, video, text or collection of all? I have used the Text type temporarily as a placeholder, and I heard DHT mentioned by @enzo today. Would that be how to use them all? If so, how? Also, is it necessary that Quest has its own type? Could Quest somehow be a characteristic of a Guild that still contains all of its information?

5 Likes

an easy way would be to host them somewhere else and just save the url which javascript then embeds. i could imagine that you‘d be able to somehow encode an image or video to binary in a way that js understands it and then load it?

3 Likes

That sounds like a good solution, and probably the way I’d end up doing it, but I wondered if there was a way you could do it internally? Maybe to reduce the amount of outside dependencies? I understand if that isn’t ideal though.

1 Like

what do you mean by „internally“?

2 Likes

I was thinking that it would be hosted somewhere, and that called in with Motoko, then use javascript to embed the Motoko call? I may be interpreting this very wrong, and this method is probably not worth it.

1 Like

Use a variant:

type QuestStatus =
  { #collection : [QuestStatus]
  ; #image : Url
  ; #text : Text
  ; #video : Url
  }:

type Quest
  { ...
  ; status : QuestStatus
  ; ...
  };
7 Likes

This looks like exactly what I’m looking for! I’ll use it and let you know how it goes! Thank you!

3 Likes