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
listenerSuccessCallback<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
urlString- the media URL
contentTypeString- the MIME type, or null
titleString- the title, or null
subtitleString- the subtitle, or null
imageUrlString- an artwork URL, or null
startMillislong- 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
millislong- 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