Function useResolvedMediaType

  • Parameters

    • Optional uri: string

      the uri to resolve (can be a url or a ipfs://<cid>)

    • Optional mimeType: string
    • Optional gatewayUrl: string

    Returns {
        mimeType: undefined | string;
        url: string;
    }

    the fully resolved url + mime type of the media

    • mimeType: undefined | string
    • url: string

    Example

    Usage with fully formed url:

    const Component = () => {
    const resolved = useResolvedMediaType("https://example.com/video.mp4");
    console.log("mime type", resolved.data.mimeType);
    console.log("url", resolved.data.url);
    return null;
    }

    Usage with ipfs cid:

    const Component = () => {
    const resolved = useResolvedMediaType("ipfs://QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvsd");
    console.log("mime type", resolved.data.mimeType);
    console.log("url", resolved.data.url);
    return null;
    }

Generated using TypeDoc