{"id":13583545,"url":"https://github.com/alxhotel/chromecast-api","last_synced_at":"2025-04-05T13:08:53.392Z","repository":{"id":46268397,"uuid":"51393388","full_name":"alxhotel/chromecast-api","owner":"alxhotel","description":":tv: Chromecast Node.js module","archived":false,"fork":false,"pushed_at":"2023-11-10T14:16:39.000Z","size":214,"stargazers_count":155,"open_issues_count":25,"forks_count":48,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-17T19:10:02.344Z","etag":null,"topics":["cast","chromecast","chromecast-api","nodejs","stream","streaming","subtitle","subtitles"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/alxhotel.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-02-09T19:32:21.000Z","updated_at":"2024-08-18T09:23:00.000Z","dependencies_parsed_at":"2024-01-24T13:04:53.799Z","dependency_job_id":null,"html_url":"https://github.com/alxhotel/chromecast-api","commit_stats":{"total_commits":111,"total_committers":15,"mean_commits":7.4,"dds":0.4504504504504504,"last_synced_commit":"077ed5eaaf4a2ac62d27b7c9e5248477e252a021"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxhotel%2Fchromecast-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxhotel%2Fchromecast-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxhotel%2Fchromecast-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alxhotel%2Fchromecast-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alxhotel","download_url":"https://codeload.github.com/alxhotel/chromecast-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"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":["cast","chromecast","chromecast-api","nodejs","stream","streaming","subtitle","subtitles"],"created_at":"2024-08-01T15:03:34.491Z","updated_at":"2025-04-05T13:08:53.346Z","avatar_url":"https://github.com/alxhotel.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"chromecast-api\n=================\n\n[![NPM Version](https://img.shields.io/npm/v/chromecast-api.svg)](https://www.npmjs.com/package/chromecast-api)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/alxhotel/chromecast-api/ci.yml?branch=master)](https://github.com/alxhotel/chromecast-api/actions)\n[![Dependency Status](https://img.shields.io/librariesio/release/npm/chromecast-api)](https://libraries.io/npm/chromecast-api)\n[![Standard - Javascript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\n**chromecast-api** is a NodeJS module to play any content in your Chromecast device.\n\n## Installation\n\n```sh\nnpm install chromecast-api \n```\n\n## Usage\n\n```js\nconst ChromecastAPI = require('chromecast-api')\n\nconst client = new ChromecastAPI()\n\nclient.on('device', function (device) {\n  var mediaURL = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4';\n\n  device.play(mediaURL, function (err) {\n    if (!err) console.log('Playing in your chromecast')\n  })\n})\n```\n\n## Supported Apps\n\n- Media (video and audio)\n- Youtube videos\n\n## Subtitles and Cover\n\nTo include subtitles and a cover image, use an Object instead of a string in the function `play(mediaObject)`:\n\n**Note**: your subtitles must implement CORS.\n\n```js\nconst ChromecastAPI = require('chromecast-api')\n\nconst media = {\n  url : 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4',\n  subtitles: [\n    {\n      language: 'en-US',\n      url: 'https://raw.githubusercontent.com/alxhotel/chromecast-api/master/test/captions_styled.vtt',\n      name: 'English',\n    },\n    {\n      language: 'es-ES',\n      url: 'https://raw.githubusercontent.com/alxhotel/chromecast-api/master/test/captions_styled_es.vtt',\n      name: 'Spanish',\n    }\n  ],\n  cover: {\n    title: 'Big Bug Bunny',\n    url: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg'\n  },\n  subtitles_style: {\n    backgroundColor: '#FFFFFF00', // see http://dev.w3.org/csswg/css-color/#hex-notation\n    foregroundColor: '#FFFFFFFF', // see http://dev.w3.org/csswg/css-color/#hex-notation\n    edgeType: 'OUTLINE', // can be: \"NONE\", \"OUTLINE\", \"DROP_SHADOW\", \"RAISED\", \"DEPRESSED\"\n    edgeColor: '#000000FF', // see http://dev.w3.org/csswg/css-color/#hex-notation\n    fontScale: 1.2, // transforms into \"font-size: \" + (fontScale*100) +\"%\"\n    fontStyle: 'BOLD', // can be: \"NORMAL\", \"BOLD\", \"BOLD_ITALIC\", \"ITALIC\",\n    fontFamily: 'Droid Sans',\n    fontGenericFamily: 'SANS_SERIF', // can be: \"SANS_SERIF\", \"MONOSPACED_SANS_SERIF\", \"SERIF\", \"MONOSPACED_SERIF\", \"CASUAL\", \"CURSIVE\", \"SMALL_CAPITALS\",\n    //windowColor: '#AA00FFFF', // see http://dev.w3.org/csswg/css-color/#hex-notation\n    //windowRoundedCornerRadius: 10, // radius in px\n    //windowType: 'ROUNDED_CORNERS' // can be: \"NONE\", \"NORMAL\", \"ROUNDED_CORNERS\"\n  }\n}\n\nconst client = new ChromecastAPI()\n\nclient.on('device', function (device) {\n  device.play(media, function (err) {\n    if (!err) console.log('Playing in your chromecast')\n  })\n})\n```\n\n## API\n\n#### `const client = new ChromecastAPI()`\n\nInitialize the client to start searching for chromecast devices.\n\n#### `client.on('device', callback)`\n\nListen for new devices by passing `callback(device)` in the callback parameter.\n\nWith the `Device` object you can now interact with your Chromecast.\n\nThis is an example of the attributes of `device`:\n```\n{\n  name: 'Chromecast-e363e7-3e23e2e-3e2e-23e34e._googlecast._tcp.local', // Unique identifier\n  friendlyName: 'Bobby', // The name you gave to your chromecast\n  host: '192.168.1.10' // Local IP address\n}\n```\n\n#### `client.devices[...]`\n\nAn array of all devices found by the client.\n\n#### `client.update()`\n\nTrigger the mDNS and SSDP search again. Warning: the `device` event will trigger again (it might return the same device).\n\n#### `device.play(mediaURL [, opts], callback)`\n\nUse this function to play any media in the chromecast device. Make sure `mediaURL` is accessible by the chromecast.\n\nPass an attribute `startTime` in the `opts` object to set where to start an audio or video content (in seconds).\n\n```\n{\n  startTime: 120 // Start the content at the 2 minute mark\n}\n```\n\n#### `device.pause(callback)`\n\nPause the media.\n\n#### `device.resume(callback)`\n\nResume the media.\n\n#### `device.stop(callback)`\n\nStop playing the media.\n\n#### `device.seek(seconds, callback)`\n\nSeek forward `seconds` in time.\n\n#### `device.seekTo(specificTime, callback)`\n\nSeek to the `specificTime` in seconds.\n\n#### `device.setVolume(level, callback)`\n\nSet the volume to a specific `level` (from 0.0 to 1.0).\n\n#### `device.changeSubtitles(index, callback)`\n\nChange the subtitles by passing the index of the subtitle you want based on the list you passed before.\n\n#### `device.changeSubtitlesSize(fontSize, callback)`\n\nChoose the subtitles font size with `fontSize`. The default is `1.0`.\n\n#### `device.subtitlesOff(callback)`\n\nTurn the subtitles off.\n\n#### `device.getCurrentTime(callback)`\n\nGet the current time of the media playing (in seconds). It's a shortcut for getting the `currentTime` from the status.\n\n#### `device.close(callback)`\n\nClose the connection with the device.\n\n#### `device.on('connected', callback)`\n\nEvent emitted when the client is connected to the device.\n\n#### `device.on('finished', callback)`\n\nEvent emitted when the media (audio or video) has finished.\n\n#### `device.on('status', callback)`\n\nEvent emitted when the device has a new status: `callback(status)`.\n\n## Additional information\n\n* Supported Media: https://developers.google.com/cast/docs/media\n* Receiver Apps: https://developers.google.com/cast/docs/receiver_apps\n\n## License\n\nMIT. Copyright (c) [Alex](https://github.com/alxhotel)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxhotel%2Fchromecast-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falxhotel%2Fchromecast-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falxhotel%2Fchromecast-api/lists"}