DuckPlayer

interface DuckPlayer

DuckPlayer interface provides a set of methods for interacting with the DuckPlayer.

Types

Link copied to clipboard
data class UserPreferences(val overlayInteracted: Boolean, val privatePlayerMode: PrivatePlayerMode)

Data class representing user preferences for Duck Player.

Functions

Link copied to clipboard

Creates a DuckPlayer URI from a YouTube no-cookie URI.

Link copied to clipboard
abstract suspend fun createYoutubeWatchUrlFromDuckPlayer(uri: Uri): String?

Creates a YouTube URI from a DuckPlayer URI.

Link copied to clipboard

Notifies the DuckPlayer that the user navigated to YouTube successfully, so subsequent requests would redirect to Duck Player

Link copied to clipboard

Notifies the DuckPlayer that the overlay was hidden after navigating back from Duck Player

Link copied to clipboard

Retrieves the current state of the DuckPlayer.

Link copied to clipboard

Retrieves the user preferences.

Link copied to clipboard
abstract suspend fun intercept(request: WebResourceRequest, url: Uri, webView: WebView): WebResourceResponse?

Notify Duck Player of a resource request and allow Duck Player to return the data.

Link copied to clipboard
abstract fun isDuckPlayerUri(uri: String): Boolean

Checks if a string is a DuckPlayer URI.

Link copied to clipboard
abstract suspend fun isSimulatedYoutubeNoCookie(uri: Uri): Boolean

Checks if a URI is a simulated YouTube no-cookie URI.

abstract suspend fun isSimulatedYoutubeNoCookie(uri: String): Boolean

Checks if a string is a YouTube no-cookie URI.

Link copied to clipboard
abstract fun isYouTubeUrl(uri: Uri): Boolean

Checks if a URI is a YouTube URL.

Link copied to clipboard
abstract suspend fun isYoutubeWatchUrl(uri: Uri): Boolean

Checks if a URI is a YouTube watch URL.

Link copied to clipboard

Retrieves a flow of user preferences.

Link copied to clipboard
abstract suspend fun sendDuckPlayerPixel(pixelName: String, pixelData: Map<String, String>)

Sends a pixel with the given name and data.

Link copied to clipboard
abstract suspend fun setUserPreferences(overlayInteracted: Boolean, privatePlayerMode: String)

Sets the user preferences.

Link copied to clipboard

Checks if the DuckPlayer overlay should be hidden after navigating back from Duck Player

Link copied to clipboard
abstract fun showDuckPlayerPrimeModal(configuration: Configuration, fragmentManager: FragmentManager, fromDuckPlayerPage: Boolean)

Shows the Duck Player Prime modal.

Link copied to clipboard
abstract suspend fun willNavigateToDuckPlayer(destinationUrl: Uri): Boolean

Checks whether a URL will trigger Duck Player loading based on URL and user settings