Klasse ChromeCast
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungfinal voidconnect()final voidfinal Stringfinal Stringfinal Stringfinal Stringfinal MediaStatusIf no application is running at the moment then exception is thrown.final StringgetModel()final StringgetName()final intgetPort()final Applicationfinal Statusfinal StringgetTitle()final booleanisAppAvailable(String appId) final booleanisAppRunning(String appId) booleanfinal booleanfinal Applicationfinal MediaStatusLoads and starts playing media in specified URLfinal MediaStatusLoads and starts playing specified mediafinal MediaStatusLoads and starts playing specified mediafinal voidpause()Pause current playbackfinal voidplay()Resume paused media playbackfinal voidfinal voidfinal voidseek(double time) Moves current playback time point to specified valuefinal voidSends some generic request to the currently running application.final <T extends Response>
TSends some generic request to the currently running application.final voidsetApplication(String application) final voidsetAppsURL(String appsURL) voidsetAutoReconnect(boolean autoReconnect) Changes behaviour for opening/closing of connection with ChromeCast device.final voidsetMuted(boolean muted) final voidvoidsetRequestTimeout(long requestTimeout) Set up how much time to wait until request is processed (in milliseconds).final voidsetVolume(float level) final voidsetVolumeByIncrement(float level) ChromeCast does not allow you to jump levels too quickly to avoid blowing speakers.final voidstopApp()Stops currently running applicationfinal voidstopSession(String sessionId) Stops the session with the given identifier.final StringtoString()final voidfinal void
-
Felddetails
-
SERVICE_TYPE
- Siehe auch:
-
-
Konstruktordetails
-
ChromeCast
-
ChromeCast
-
-
Methodendetails
-
getName
- Gibt zurück:
- The technical name of the device. Usually something like Chromecast-e28835678bc02247abcdef112341278f.
-
setName
-
getAddress
- Gibt zurück:
- The IP address of the device.
-
getPort
public final int getPort()- Gibt zurück:
- The TCP port number that the device is listening to.
-
getAppsURL
-
setAppsURL
-
getApplication
- Gibt zurück:
- The mDNS service name. Usually "googlecast".
- Siehe auch:
-
setApplication
-
getTitle
- Gibt zurück:
- The name of the device as entered by the person who installed it. Usually something like "Living Room Chromecast".
-
getAppTitle
- Gibt zurück:
- The title of the app that is currently running, or empty string in case of the backdrop. Usually something like "YouTube" or "Spotify", but could also be, say, the URL of a web page being mirrored.
-
getModel
- Gibt zurück:
- The model of the device. Usually "Chromecast" or, if Chromecast is built into your TV, the model of your TV.
-
connect
- Löst aus:
IOExceptionGeneralSecurityException
-
disconnect
- Löst aus:
IOException
-
isConnected
public final boolean isConnected() -
setAutoReconnect
public void setAutoReconnect(boolean autoReconnect) Changes behaviour for opening/closing of connection with ChromeCast device. If set to "true" (default value) then connection will be re-established on every request in case it is not present yet, or has been lost. "false" value means manual control over connection with ChromeCast device, i.e. callingconnect()ordisconnect()methods when needed.- Parameter:
autoReconnect- true means controlling connection with ChromeCast device automatically, false - manually- Siehe auch:
-
isAutoReconnect
public boolean isAutoReconnect()- Gibt zurück:
- current value of
autoReconnectsetting, which controls opening/closing of connection with ChromeCast device - Siehe auch:
-
setRequestTimeout
public void setRequestTimeout(long requestTimeout) Set up how much time to wait until request is processed (in milliseconds).- Parameter:
requestTimeout- value in milliseconds until request times out waiting for response
-
getStatus
- Gibt zurück:
- current chromecast status - volume, running applications, etc.
- Löst aus:
IOException
-
getRunningApp
- Gibt zurück:
- descriptor of currently running application
- Löst aus:
IOException
-
isAppAvailable
- Parameter:
appId- application identifier- Gibt zurück:
- true if application is available to this chromecast device, false otherwise
- Löst aus:
IOException
-
isAppRunning
- Parameter:
appId- application identifier- Gibt zurück:
- true if application with specified identifier is running now
- Löst aus:
IOException
-
launchApp
- Parameter:
appId- application identifier- Gibt zurück:
- application descriptor if app successfully launched, null otherwise
- Löst aus:
IOException
-
stopApp
Stops currently running application
If no application is running at the moment then exception is thrown.
- Löst aus:
IOException
-
stopSession
Stops the session with the given identifier.
- Parameter:
sessionId- session identifier- Löst aus:
IOException
-
setVolume
- Parameter:
level- volume level from 0 to 1 to set- Löst aus:
IOException
-
setVolumeByIncrement
ChromeCast does not allow you to jump levels too quickly to avoid blowing speakers. Setting by increment allows us to easily get the level we want- Parameter:
level- volume level from 0 to 1 to set- Löst aus:
IOException- Siehe auch:
-
setMuted
- Parameter:
muted- is to mute or not- Löst aus:
IOException
-
getMediaStatus
If no application is running at the moment then exception is thrown.
- Gibt zurück:
- current media status, state, time, playback rate, etc.
- Löst aus:
IOException
-
play
Resume paused media playback
If no application is running at the moment then exception is thrown.
- Löst aus:
IOException
-
pause
Pause current playback
If no application is running at the moment then exception is thrown.
- Löst aus:
IOException
-
seek
Moves current playback time point to specified value
If no application is running at the moment then exception is thrown.
- Parameter:
time- time point between zero and media duration- Löst aus:
IOException
-
load
Loads and starts playing media in specified URL
If no application is running at the moment then exception is thrown.
- Parameter:
url- media url- Gibt zurück:
- The new media status that resulted from loading the media.
- Löst aus:
IOException
-
load
public final MediaStatus load(String mediaTitle, String thumb, String url, String contentType) throws IOException Loads and starts playing specified media
If no application is running at the moment then exception is thrown.
- Parameter:
mediaTitle- name to be displayedthumb- url of video thumbnail to be displayed, relative to media urlurl- media urlcontentType- MIME content type- Gibt zurück:
- The new media status that resulted from loading the media.
- Löst aus:
IOException
-
load
Loads and starts playing specified media
If no application is running at the moment then exception is thrown.
- Parameter:
media- The media to load and play. See https://developers.google.com/cast/docs/reference/messages#Load for more details.- Gibt zurück:
- The new media status that resulted from loading the media.
- Löst aus:
IOException
-
send
public final <T extends Response> T send(String namespace, Request request, Class<T> responseClass) throws IOException Sends some generic request to the currently running application.
If no application is running at the moment then exception is thrown.
- Typparameter:
T- type of response- Parameter:
namespace- request namespacerequest- request objectresponseClass- class of the response for proper deserialization- Gibt zurück:
- deserialized response
- Löst aus:
IOException
-
send
Sends some generic request to the currently running application. No response is expected as a result of this call.
If no application is running at the moment then exception is thrown.
- Parameter:
namespace- request namespacerequest- request object- Löst aus:
IOException
-
registerListener
-
unregisterListener
-
registerConnectionListener
-
unregisterConnectionListener
-
toString
-