Summary
Currently, the media types, support for the icon
field are svg
, png
, webp
, which limits the design space for the developer to show content.
The goal is to introduce default media types supported by most of the latest browsers, which will widen the type of content that blinks can show starting with video/audio and more types of images.
Media Types
1. Image Types
- JPEG (
image/jpeg
) - GIF (
image/gif
) - BMP (
image/bmp
)
2. Audio Types
- MP3 (
audio/mpeg
) - WAV (
audio/wav
) - OGG (
audio/ogg
) - AAC (
audio/aac
) - WebM Audio (
audio/webm
)
3. Video Types
- MP4 (
video/mp4
) - WebM (
video/webm
) - OGG Video (
video/ogg
) - MPEG (
video/mpeg
)
Implementation
Currently the ActionGetResponse
looks like below
/**
* Response body payload returned from the initial Action GET Request
*
* note: `type` is optional for backwards compatibility
*/
export interface ActionGetResponse extends Omit<Action, "type"> {
type?: "action";
}
/**
* A single Solana Action
*/
export interface Action<T extends ActionType = "action"> {
/** type of Action to present to the user */
type: T;
/** image url that represents the source of the action request */
icon: string;
/** describes the source of the action request */
title: string;
/** brief summary of the action to be performed */
description: string;
/** button text rendered to the user */
label: string;
/** UI state for the button being rendered to the user */
disabled?: boolean;
links?: {
/** list of related Actions a user could perform */
actions: LinkedAction[];
};
/** non-fatal error message to be displayed to the user */
error?: ActionError;
}
If we modify the Action
to include 2 additional fields, media
and mediaType
/**
* Media Types for media in the action
*/
export type MediaType = "video/mp4" | "video/webm" | "video/ogg" | "video/mpeg" | "image/jpeg" | "image/png" | "image/gif" | "image/svg+xml" | "image/webp" | "image/bmp" | "image/x-icon" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "audio/aac" | "audio/webm"
/**
* A single Solana Action
*/
export interface Action<T extends ActionType = "action"> {
/** type of Action to present to the user */
type: T;
/** image url that represents the source of the action request, and
will be used as a fallback image incase
media URL is un-reachable/un-renderable */
icon: string;
/** media URL that represents the content to be shown upon request**/
media : string;
/** represents the type of media URL provided */
mediaType : MediaType;
/** describes the source of the action request */
title: string;
/** brief summary of the action to be performed */
description: string;
/** button text rendered to the user */
label: string;
/** UI state for the button being rendered to the user */
disabled?: boolean;
links?: {
/** list of related Actions a user could perform */
actions: LinkedAction[];
};
/** non-fatal error message to be displayed to the user */
error?: ActionError;
}
Then this would allow the blink developer to include more media types, icon
field would still be present to maintain backward compatibility + used as a fallback if the media URL is un-reachable / un-renderable.