Host App Integration Guide
This guide is for App Engineers (Wallets, Portals, Super-Apps) who want to host games that use the Playsout Hybrid SDK. By providing a bridge interface, games will automatically detect your app and delegate logins or payments natively.
1. Current State: JS Bridge (EIP-1193 / window.ethereum)
Currently, the most mature and zero-configuration host integration leverages existing standard web provider APIs. If your app is a crypto wallet (extension or mobile webview) that injects window.ethereum, no extra work is needed.
The SDK’s built-in InjectedProviderAdapter automatically detects EIP-6963 and EIP-1193 providers.
If the game calls sdk.pay.purchase(), the SDK translates the config into standard EVM contract calls (eth_sendTransaction). If the game calls sdk.identity.signIn(), it executes a standard SIWE (personal_sign).
2. General JS Bridge (NativeBridgeAdapter)
If you are not an EVM wallet and just want to pass data from your native Android/iOS shell down into the Webview, inject a global object named __PLAYSOUT_NATIVE_BRIDGE__ before the game loads.
(See API Reference for full NativeBridge Interface details)
// Example: Minimal implementation injected by Host Webview
window.__PLAYSOUT_NATIVE_BRIDGE__ = {
getUser: async () => {
// e.g., call out to Android JavascriptInterface
return { userId: "app-user-id", displayName: "Tester" };
},
purchase: async (productId) => {
// e.g., trigger Android native Google Play IAP
return { orderId: "123", status: "success" };
}
};3. Future Roadmap
TODO (Phase X): Official Android / iOS Host SDKs
While the JS Bridge mechanism works today, maintaining the injection lifecycle and asynchronous promise bridging across the Webview boundary can be tedious.
In a future phase, we will provide dropping native packages (e.g., com.playsout.hostsdk:android) that provide clean Kotlin/Swift interfaces and automatically handle injecting the Javascript bridge into the WebView instance.