Streamit Laravel - Documentation

Streamit Laravel Flutter App – Short Drama Add-on Install Guide

This add-on is installed in two steps only:

1. Copy the short_drama folder into lib/.

2. Register the module in lib/addon_registration.dart.

    Prerequisites

    • The Laravel backend must already have the Short Drama add-on plugin installed and configured correctly.
    • The backend base URL must match the value of DOMAIN_URL in lib/configs.dart.

    Install Steps

    1) Copy the add-on folder into lib/

    Copy the add-on folder so the project contains:

    • YOUR_FLUTTER_APP/lib/short_drama/

    That folder already includes the Short Drama module files.

    2) Register the add-on in one place

    Open YOUR_FLUTTER_APP/lib/addon_registration.dart and add the Short Drama registration call:

    import 'package:streamit_laravel/addon_bridge/short_drama/short_drama_bridge.dart';
    import 'package:streamit_laravel/short_drama/short_drama_delegate_impl.dart';
    
    class ShortDramaAddon {
      static void register() {
        ShortDramaBridge.register(ShortDramaDelegateImpl());
      }
    }

    Deep Linking (optional)

    Skip this section entirely if you do not need shared episode links to open in the app. Short Drama works without it; links simply open in the browser.

    Shared links look like https://YOUR_DOMAIN/short-drama/sd2_<token>. The token is encrypted, so the module decodes it and resolves the drama, episode and resume position before navigating.

    Prerequisites

    • encrypt and crypto must be in your pubspec.yaml. Both ship with the base app; confirm they are present before continuing.
    • The host app must expose the deep-link methods on ShortDramaBridge (handleDeepLink, resumePendingDeepLink, deepLinkHandledThisLaunch). Older hosts predate them – update the bridge first or this section will not compile.

    1) Declare the intent filter (Android)

    In YOUR_FLUTTER_APP/android/app/src/main/AndroidManifest.xml, inside the MainActivity activity, add your domain:

    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" />
        <data android:scheme="http" />
        <data android:host="YOUR_DOMAIN" />
        <data android:pathPrefix="/short-drama" />
    </intent-filter>

    Replace YOUR_DOMAIN with the host in DOMAIN_URL. autoVerify requires a matching assetlinks.json served from https://YOUR_DOMAIN/.well-known/, otherwise Android shows the app chooser instead of opening the app directly.

    2) Route incoming links (lib/screens/splash_controller.dart)

    Deep links reach the app while the splash screen is running. Two edits:

    import 'package:streamit_laravel/addon_bridge/short_drama/short_drama_bridge.dart';
    
    void handleDeepLinking({required String deepLink}) {
      if (deepLink.contains('short-drama')) {
        ShortDramaBridge.handleDeepLink(deepLink);
        return;
      }
      // ...your existing content-details routing...
    }

    Then guard the splash redirect timer, so it does not navigate over a link that has already been handled:

    if (ShortDramaBridge.deepLinkHandledThisLaunch) return;

    3) Resume after profile selection (lib/screens/profile/watching_profile/watching_profile_screen.dart)

    A link can arrive before a watching profile is chosen. On profile select, resume it instead of going to the dashboard:

    ShortDramaBridge.resumePendingDeepLink().then((resumed) {
      if (!resumed) {
        Get.offAll(() => DashboardScreen());
      }
    });

    Why these call the bridge

    Every call above goes through ShortDramaBridge, never through short_drama/ directly. When the add-on is not registered the bridge returns false and the host falls through to its normal routing, so the app still compiles and runs without the add-on installed. Importing short_drama/service/short_drama_deep_link_service.dart from host files breaks that guarantee – do not do it.

    Verify

    adb shell am start -a android.intent.action.VIEW   -d "https://YOUR_DOMAIN/short-drama/sd2_<token>"

    The app should open the episode at its saved position. If it opens on the dashboard instead, the link was not claimed – check the intent filter host and that ShortDramaAddon.register() runs before the link is processed.

    Limitations

    • Android only. iOS Universal Links need an associated-domains entitlement and an apple-app-site-association file, neither of which ships with the base app. On iOS these links open in Safari.
    • A link is handled once per launch, tracked by deepLinkHandledThisLaunch.

    Notes

    If the backend base URL in lib/configs.dart does not match the Laravel environment, Short Drama will not load correctly.

    In this codebase the file is named lib/addon_registration.dart.

    lib/main.dart already calls ShortDramaAddon.register() during startup.