[BETA] ThChromeCast for app inventor to interact with Chromecast devices

🧩 ThChromeCast

An extension for MIT App Inventor 2.
Developed by th using Fast. ThChromeCast Extension for app inventor to interact with Chromecast devices.

Currently This Extension is Development Stages.

found error and bugs. Anyone can fix this error check GitHub repo.

:memo: Specifications


:floppy_disk: Size: 4.20 MB
:gear: Version: 1.0
:iphone: Minimum API Level: 7
:date: Updated On: 2025-01-14T19:00:00Z
:computer: Built & documented using: FAST-CLI

test aix here

io.th.thchromecast.thchromecast.aix (4.2 MB)

Source Code on GitHub



ErrorOccurredBlock

OnAppLaunchedBlock
OnConnectedBlock
OnDisconnectedBlock
OnDiscoveryStartedBlock

OnDiscoveryStoppedBlock
OnMediaLoadedBlock
OnMediaSeekedBlock
OnPermissionsDeniedBlock
OnPermissionsGrantedBlock

OnPlaybackPausedBlock
OnPlaybackStoppedBlock
OnVolumeChangedBlock

AddDeviceBlock
ConnectBlock
DisconnectBlock
DiscoveredDevicesBlock
GetDevicesBlock

IsAppAvailableBlock
IsAppRunningBlock
LaunchAppBlock
PausePlaybackBlock
PlayMediaBlock

RequestPermissionsBlock
RestartDiscoveryBlock
RunningAppBlock
SeekMediaBlock
SetApplicationBlock
SetAppsURLBlock
SetAutoReconnectBlock
SetNameBlock
SetVolume2Block
SetVolumeBlock
StartDiscoveryBlock
StatusBlock
StopAppBlock
StopDiscoveryBlock
StopPlaybackBlock
StopSessionBlock
AddressBlock
AppIDBlock
ApplicationBlock
AppsURLBlock
AppTitleBlock
IsAutoReconnectBlock
ModelBlock
NameBlock
PortBlock
TitleBlock

Events:

ThChromeCast has total 13 events.

:yellow_heart: OnPermissionsGranted

Triggered when all required permissions are granted.

:yellow_heart: OnPermissionsDenied

Triggered when permission request is denied.

:yellow_heart: OnConnected

Triggered when connected to a Chromecast device.

Parameter Type
ipAddress text

:yellow_heart: OnDisconnected

Triggered when disconnected from a Chromecast device.

:yellow_heart: OnMediaLoaded

Triggered when media is successfully loaded.

:yellow_heart: OnPlaybackPaused

Triggered when playback is paused.

:yellow_heart: OnPlaybackStopped

Triggered when playback is stopped.

:yellow_heart: OnVolumeChanged

Triggered when the volume is changed.

Parameter Type
volume number

:yellow_heart: ErrorOccurred

Triggered when an error occurs.

Parameter Type
errorMessage text

:yellow_heart: OnAppLaunched

Triggered when an app is launched on the Chromecast.

Parameter Type
appId text

:yellow_heart: OnMediaSeeked

Triggered when media is seeked to a specific time.

Parameter Type
time number

:yellow_heart: OnDiscoveryStarted

Triggered when discovery is started.

:yellow_heart: OnDiscoveryStopped

Triggered when discovery is stopped.

Methods:

ThChromeCast has total 26 methods.

:purple_heart: RequestPermissions

Request required permissions dynamically.

:purple_heart: SetName

Sets the technical name of the device.

Parameter Type
name text

:purple_heart: SetAppsURL

Sets the URL for accessing apps on the device.

Parameter Type
appsURL text

:purple_heart: SetApplication

Sets the mDNS service name.

Parameter Type
application text

:purple_heart: AddDevice

Manually add Chromecast device by its IP address.

Parameter Type
ipAddress text

:purple_heart: GetDevices

Get the list of added devices.

:purple_heart: Connect

Connect to a Chromecast by its IP address.

Parameter Type
ipAddress text

:purple_heart: Disconnect

Disconnect from the current Chromecast.

:purple_heart: PlayMedia

Play media on the connected Chromecast.

Parameter Type
mediaUrl text
contentType text

:purple_heart: PausePlayback

Pause playback on the connected Chromecast.

:purple_heart: StopPlayback

Stop playback on the connected Chromecast.

:purple_heart: SetVolume

Set the volume on the connected Chromecast.

Parameter Type
volume number

:purple_heart: Status

Get the current status of the connected Chromecast.

:purple_heart: RunningApp

Get the running app on the connected Chromecast.

:purple_heart: IsAppAvailable

Check if an app is available on the connected Chromecast.

Parameter Type
appId text

:purple_heart: IsAppRunning

Check if an app is running on the connected Chromecast.

Parameter Type
appId text

:purple_heart: LaunchApp

Launch an app on the connected Chromecast. id like (233637DE)

Parameter Type
appId text

:purple_heart: SeekMedia

Seek media playback to a specific time.

Parameter Type
time number

:purple_heart: StartDiscovery

Start discovering Chromecast devices on the network.

:purple_heart: StopDiscovery

Stop discovering Chromecast devices on the network.

:purple_heart: DiscoveredDevices

Get the list of discovered Chromecast devices.

:purple_heart: RestartDiscovery

Restart Discovery

:purple_heart: SetAutoReconnect

Changes behavior for opening/closing connection with ChromeCast device.

Parameter Type
autoReconnect boolean

:purple_heart: StopApp

Stops currently running application. Throws exception if no application is running.

:purple_heart: StopSession

Stops the session with the given identifier.

Parameter Type
sessionId text

:purple_heart: SetVolume2

Sets the volume level from 0 to 1.

Parameter Type
level number

Designer:

ThChromeCast has total 1 designer property.

:green_apple: AppID

  • Input type: string

Setter:

ThChromeCast has total 1 setter property.

:green_heart: AppID

Set app ID.

  • Input type: text

Getters:

ThChromeCast has total 9 getter properties.

:green_circle: Name

Returns the technical name of the device.

  • Return type: text

:green_circle: Address

Returns the IP address of the device.

  • Return type: text

:green_circle: Port

Returns the TCP port number (like 8009) that the device is listening to.

  • Return type: number

:green_circle: AppsURL

Returns the URL for accessing apps on the device.

  • Return type: text

:green_circle: Application

Returns the mDNS service name, usually 'googlecast'.

  • Return type: text

:green_circle: Title

Returns the name of the device as entered by the person who installed it.

  • Return type: text

:green_circle: AppTitle

Returns the title of the app that is currently running, or empty string in case of the backdrop.

  • Return type: text

:green_circle: Model

Returns the model of the device. Usually 'Chromecast' or, if Chromecast is built into your TV, the model of your TV.

  • Return type: text

:green_circle: IsAutoReconnect

Returns the current value of the autoReconnect setting.

  • Return type: boolean
3 Likes

Cool, keep on :heart: