DEEPLINKX / app

YouTube

YouTube actions, setup, native platforms, and fallback options.

DeeplinkX 1.5.8 · Source

Platforms and setup

Native platforms: ios, android.

Public actions

YouTube.open

factory YouTube.open({final bool fallbackToStore = false})

Launch with DeeplinkX.launchApp. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
fallbackToStoreboolNofalse

Exact source

YouTube.openVideo

static YouTubeOpenVideoAction openVideo({ required final String videoId, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
videoIdStringYes—
fallbackToStoreboolNofalse

Exact source

YouTube.openChannel

static YouTubeOpenChannelAction openChannel({ required final String channelId, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
channelIdStringYes—
fallbackToStoreboolNofalse

Exact source

YouTube.openPlaylist

static YouTubeOpenPlaylistAction openPlaylist({ required final String playlistId, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
playlistIdStringYes—
fallbackToStoreboolNofalse

Exact source

static YouTubeSearchAction search({ required final String query, final bool fallbackToStore = false, })

Launch with DeeplinkX.launchAction. Native platforms: ios, android. Action web fallback: available. Store-fallback flag: supported; opt in explicitly.

ParameterTypeRequiredDefault
queryStringYes—
fallbackToStoreboolNofalse

Exact source

Provider setup and examples

DeeplinkX provides comprehensive support for YouTube deep linking actions.

Available Actions

Launch YouTube App

final deeplinkX = DeeplinkX();

// Simple launch
await deeplinkX.launchApp(YouTube.open());

// Launch with store fallback if not installed
await deeplinkX.launchApp(YouTube.open(fallbackToStore: true));

// Launch with fallback disabled
await deeplinkX.launchApp(YouTube.open(), disableFallback: true);

Open Video Action

final deeplinkX = DeeplinkX();

// Simple action
await deeplinkX.launchAction(YouTube.openVideo(videoId: 'dQw4w9WgXcQ')); // YouTube video ID

// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.openVideo(
  videoId: 'dQw4w9WgXcQ', // YouTube video ID
  fallbackToStore: true,
));

// Action with fallback disabled
await deeplinkX.launchAction(
  YouTube.openVideo(videoId: 'dQw4w9WgXcQ'), // YouTube video ID
  disableFallback: true,
);

Open Channel Action

final deeplinkX = DeeplinkX();

// Simple action
await deeplinkX.launchAction(YouTube.openChannel(channelId: 'UCq-Fj5jknLsUf-MWSy4_brA')); // YouTube channel ID

// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.openChannel(
  channelId: 'UCq-Fj5jknLsUf-MWSy4_brA', // YouTube channel ID
  fallbackToStore: true,
));

// Action with fallback disabled
await deeplinkX.launchAction(
  YouTube.openChannel(channelId: 'UCq-Fj5jknLsUf-MWSy4_brA'), // YouTube channel ID
  disableFallback: true,
);

Open Playlist Action

final deeplinkX = DeeplinkX();

// Simple action
await deeplinkX.launchAction(YouTube.openPlaylist(playlistId: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI')); // YouTube playlist ID

// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.openPlaylist(
  playlistId: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI', // YouTube playlist ID
  fallbackToStore: true,
));

// Action with fallback disabled
await deeplinkX.launchAction(
  YouTube.openPlaylist(playlistId: 'PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI'), // YouTube playlist ID
  disableFallback: true,
);

Search Action

final deeplinkX = DeeplinkX();

// Simple action
await deeplinkX.launchAction(YouTube.search(query: 'flutter tutorial')); // Search query

// Action with store fallback if not installed
await deeplinkX.launchAction(YouTube.search(
  query: 'flutter tutorial', // Search query
  fallbackToStore: true,
));

// Action with fallback disabled
await deeplinkX.launchAction(
  YouTube.search(query: 'flutter tutorial'), // Search query
  disableFallback: true,
);

Required Permissions

Android

To check if YouTube is installed on Android, add the following to your AndroidManifest.xml:

<queries>
    <package android:name="com.google.android.youtube" />
</queries>

Scheme Configuration

iOS

To handle YouTube deeplinks on iOS, add the following to your Info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>youtube</string>
</array>

Supported Fallback Stores

When the YouTube app is not installed, DeeplinkX can redirect users to download YouTube from the following app stores:

  • iOS App Store
  • Google Play Store

Fallback Behavior

DeeplinkX follows this sequence when handling YouTube deeplinks:

  1. First, it attempts to launch the YouTube app if it's installed on the device.
  2. If the YouTube app is not installed and fallbackToStore is set to true, it will redirect to the appropriate app store based on the user's platform (iOS App Store or Google Play Store).
  3. If no supported store is available for the current platform or the store app cannot be launched, it will fall back to opening the YouTube web interface in the default browser.
  4. You can disable all fallbacks by setting disableFallback: true in the launch methods.

Check If YouTube Is Installed

final deeplinkX = DeeplinkX();
final isInstalled = await deeplinkX.isAppInstalled(YouTube());