{"id":19856951,"url":"https://github.com/johnvuko/flutter_cast","last_synced_at":"2025-04-14T05:23:26.688Z","repository":{"id":42375596,"uuid":"266380769","full_name":"johnvuko/flutter_cast","owner":"johnvuko","description":"Dart package to discover and connect with Chromecast devices","archived":false,"fork":false,"pushed_at":"2024-08-09T08:29:36.000Z","size":269,"stargazers_count":48,"open_issues_count":29,"forks_count":41,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T19:13:24.999Z","etag":null,"topics":["chromecast","dart","flutter"],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnvuko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-23T16:57:30.000Z","updated_at":"2025-03-25T23:25:36.000Z","dependencies_parsed_at":"2024-12-24T10:21:14.261Z","dependency_job_id":"909f92b8-5ae2-449d-a8d4-894884ba069a","html_url":"https://github.com/johnvuko/flutter_cast","commit_stats":null,"previous_names":["johnvuko/flutter_cast"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnvuko%2Fflutter_cast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnvuko%2Fflutter_cast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnvuko%2Fflutter_cast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnvuko%2Fflutter_cast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnvuko","download_url":"https://codeload.github.com/johnvuko/flutter_cast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248825303,"owners_count":21167457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromecast","dart","flutter"],"created_at":"2024-11-12T14:17:03.084Z","updated_at":"2025-04-14T05:23:26.667Z","avatar_url":"https://github.com/johnvuko.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Pub Likes](https://img.shields.io/pub/likes/cast)](https://pub.dev/packages/cast)\n[![Pub Popularity](https://img.shields.io/pub/popularity/cast)](https://pub.dev/packages/cast)\n[![Pub Points](https://img.shields.io/pub/points/cast)](https://pub.dev/packages/cast)\n\n# cast\n\nDart package to discover and connect with Chromecast devices\n\n## Installation\n\nAdd this to your package's pubspec.yaml file:\n\n```\ndependencies:\n  cast: ^2.1.0\n```\n\n### iOS\n\nRequired iOS 13 minimum.\nSince iOS 14 a few more steps are required https://developers.google.com/cast/docs/ios_sender/ios_permissions_changes\n\nIn `ios/Runner/Info.plist` add:\n\n```xml\n\u003ckey\u003eNSBonjourServices\u003c/key\u003e\n\u003carray\u003e\n  \u003cstring\u003e_googlecast._tcp\u003c/string\u003e\n  \u003cstring\u003e_YOUR_APP_ID._googlecast._tcp\u003c/string\u003e\n\u003c/array\u003e\n\n\u003ckey\u003eNSLocalNetworkUsageDescription\u003c/key\u003e\n\u003cstring\u003e${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi\nnetwork.\u003c/string\u003e\n```\n\n## Usage\n\nList devices:\n\n```\nWidget build(BuildContext context) {\n  return FutureBuilder\u003cList\u003cCastDevice\u003e\u003e(\n    future: CastDiscoveryService().search(),\n    builder: (context, snapshot) {\n      if (snapshot.hasError) {\n        return Center(\n          child: Text(\n            'Error: ${snapshot.error.toString()}',\n          ),\n        );\n      } else if (!snapshot.hasData) {\n        return Center(\n          child: CircularProgressIndicator(),\n        );\n      }\n\n      if (snapshot.data!.isEmpty) {\n        return Column(\n          children: [\n            Center(\n              child: Text(\n                'No Chromecast founded',\n              ),\n            ),\n          ],\n        );\n      }\n\n      return Column(\n        children: snapshot.data!.map((device) {\n          return ListTile(\n            title: Text(device.name),\n            onTap: () {\n              _connectToYourApp(context, device);\n            },\n          );\n        }).toList(),\n      );\n    },\n  );\n}\n```\n\nConnect to device:\n\n```\nFuture\u003cvoid\u003e _connect(BuildContext context, CastDevice object) async {\n  final session = await CastSessionManager().startSession(object);\n\n  session.stateStream.listen((state) {\n    if (state == CastSessionState.connected) {\n      _sendMessage(session);\n    }\n  });\n\n  session.messageStream.listen((message) {\n    print('receive message: $message');\n  });\n\n  session.sendMessage(CastSession.kNamespaceReceiver, {\n    'type': 'LAUNCH',\n    'appId': 'YouTube', // set the appId of your app here\n  });\n}\n```\n\n`CastSessionManager` is used to keep track of all sessions.\n\nSend message:\n\n```\nvoid _sendMessage(CastSession session) {\n  session.sendMessage('urn:x-cast:namespace-of-the-app', {\n    'type': 'sample',\n  });\n}\n```\n\nExcept for the launch message, you should wait until the session have a connected state before sending message.\n\n## Note\n\nSome informations about the protocol used https://docs.rs/crate/gcast/0.1.5/source/PROTOCOL.md\n\n    $ pub global activate protoc_plugin\n    $ export PATH=\"$PATH\":\"$HOME/.pub-cache/bin\"\n    $ protoc -I=./lib/cast_channel --dart_out=./lib/cast_channel ./lib/cast_channel/cast_channel.proto --plugin \"pub run protoc_plugin\"\n\n## Author\n\n- [Jonathan VUKOVICH](https://github.com/johnvuko)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnvuko%2Fflutter_cast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnvuko%2Fflutter_cast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnvuko%2Fflutter_cast/lists"}