soundcloud-api-ts - v1.15.0
    Preparing search index...

    Function getSoundCloudWidgetUrl

    • Returns an encoded SoundCloud widget embed URL for a given track ID.

      Parameters

      • trackId: string | number

        The track's numeric ID or string identifier

      Returns string

      URL-encoded widget embed URL string

      Do not pass this to soundcloud-widget-react <SCWidget url>. That package expects a plain unencoded SoundCloud URL (permalink_url) and encodes it itself. This helper is only for building a widget iframe src query fragment yourself.

      import { getSoundCloudWidgetUrl } from 'soundcloud-api-ts';

      const widgetUrl = getSoundCloudWidgetUrl(123456);
      console.log(widgetUrl);