Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public interface GoogleCast.Provider

A platform Google Cast implementation. The Android build registers one; applications do not normally implement this.

Methods

public abstract void setStateListener(SuccessCallback<Integer> listener)Installs the listener the provider reports session states to, from any thread, as Cast.STATE_* values.
public abstract boolean showRoutePicker()Shows a device chooser and connects to the chosen device.
public abstract boolean isSessionActive()
public abstract boolean load(String url, String contentType, String title, String subtitle, String imageUrl, long startMillis)Loads media on the receiver.
public abstract boolean play()
public abstract boolean pause()
public abstract boolean seek(long millis)Seeks the receiver.
public abstract boolean stop()Stops playback and ends the session.

Method details

setStateListener

public abstract void setStateListener(SuccessCallback<Integer> listener)
Installs the listener the provider reports session states to, from any thread, as Cast.STATE_* values.

Parameters

listener SuccessCallback<Integer>
receives state changes

showRoutePicker

public abstract boolean showRoutePicker()
Shows a device chooser and connects to the chosen device.

Returns

true when the chooser was shown

isSessionActive

public abstract boolean isSessionActive()

Returns

true while connected to a receiver

load

public abstract boolean load(String url, String contentType, String title, String subtitle, String imageUrl, long startMillis)
Loads media on the receiver.

Parameters

url String
the media URL
contentType String
the MIME type, or null
title String
the title, or null
subtitle String
the subtitle, or null
imageUrl String
an artwork URL, or null
startMillis long
the start position

Returns

true when the request was sent

play

public abstract boolean play()

Returns

true when the request was sent

pause

public abstract boolean pause()

Returns

true when the request was sent

seek

public abstract boolean seek(long millis)
Seeks the receiver.

Parameters

millis long
the position

Returns

true when the request was sent

stop

public abstract boolean stop()
Stops playback and ends the session.

Returns

true when the request was sent