All Zemer Cipher functionality depends on a one-time initialization call.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ZemerTeam/zemer-cipher/llms.txt
Use this file to discover all available pages before exploring further.
ZemerCipher.initialize() sets up the shared OkHttpClient, loads the bundled player configs, schedules a background config refresh, and prepares CipherDeobfuscator. It must be called before any deobfuscation or PoToken calls.
Basic Initialization
CallZemerCipher.initialize() in your Application.onCreate(). This is the recommended location because it runs before any Activity, Service, or ContentProvider starts.
Application subclass in AndroidManifest.xml:
Initialization Parameters
ZemerCipher.initialize() accepts three parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
context | Context | — | Required. Pass applicationContext to avoid memory leaks. |
proxy | Proxy? | null | Optional java.net.Proxy. When set, all HTTP requests (player JS fetch, config fetch) route through this proxy. Can be changed at runtime via ZemerCipher.proxy. |
debugLogging | Boolean | false | Enables verbose Timber logging. Recommended value: BuildConfig.DEBUG. |
What Initialization Does
CallingZemerCipher.initialize() performs the following steps in order:
CipherDeobfuscator.initialize(context)— Stores the application context soCipherDeobfuscatorcan create aCipherWebViewon demand without holding an Activity reference.ZemerCipher.proxy = proxy— Stores the optional proxy reference. The sharedOkHttpClientis built lazily on first use, so setting proxy here takes effect before any network request.ZemerCipher.debugLogging = debugLogging— Enables or disables verbose Timber logging across the library.PlayerConfigStore.initialize(context)— Loads the bundledplayer_configs.jsonasset (the offline default) and overlays the last-good cached remote copy from<filesDir>/cipher_cache/configs_remote.json, if present and valid.PlayerConfigStore.scheduleStartupRefresh()— Fires a background coroutine that checks the 6-hour TTL. If the remote config is stale, it fetches a fresh copy from the zemer-cipher GitHub repository.PlayerDatesStore.initialize(context)— Loads player date metadata used for internal bookkeeping.
Prewarming the WebView
After initialization, theCipherWebView is created lazily on the first call to deobfuscateStreamUrl. To eliminate this cold-start delay before the first playback request, call CipherDeobfuscator.prewarm() from a background coroutine:
Changing Proxy at Runtime
TheZemerCipher.proxy property can be changed at any point after initialization. The shared OkHttpClient is rebuilt on the next request when the proxy reference changes (checked by reference equality):