{"id":13631034,"url":"https://github.com/guerrerocarlos/chromecast-js","last_synced_at":"2025-03-31T10:02:20.280Z","repository":{"id":19485224,"uuid":"22730997","full_name":"guerrerocarlos/chromecast-js","owner":"guerrerocarlos","description":"Chromecast Node.js module","archived":false,"fork":false,"pushed_at":"2022-01-21T10:48:16.000Z","size":58,"stargazers_count":160,"open_issues_count":19,"forks_count":34,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-22T23:36:34.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guerrerocarlos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-07T17:56:47.000Z","updated_at":"2024-11-28T16:29:50.000Z","dependencies_parsed_at":"2022-09-14T13:41:42.382Z","dependency_job_id":null,"html_url":"https://github.com/guerrerocarlos/chromecast-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guerrerocarlos%2Fchromecast-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guerrerocarlos%2Fchromecast-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guerrerocarlos%2Fchromecast-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guerrerocarlos%2Fchromecast-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guerrerocarlos","download_url":"https://codeload.github.com/guerrerocarlos/chromecast-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246450409,"owners_count":20779406,"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":[],"created_at":"2024-08-01T22:02:07.973Z","updated_at":"2025-03-31T10:02:20.201Z","avatar_url":"https://github.com/guerrerocarlos.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"chromecast-js\n=================\n\nchromecast-js is a javascript client library for googlecast's remote playback protocol that uses DefaultMediaReceiver to play any (compatible) content in the Chromecast, it works by wrapping the [node-castv2-client](https://github.com/thibauts/node-castv2-client) module.\n\n## Installation\n\nFrom npm:\n\n\tnpm install chromecast-js \n\n## Usage\n\n``` javascript\nchromecastjs = require('chromecast-js')\n\nvar browser = new chromecastjs.Browser()\n\nbrowser.on('deviceOn', function(device){\n  device.connect()\n  device.on('connected', function(){\n\n    device.play('http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4', 60, function(){\n        console.log('Playing in your chromecast!')\n    });\n\n    setTimeout(function(){\n        device.pause(function(){\n            console.log('Paused!')\n        });\n    }, 30000);\n\n    setTimeout(function(){\n        device.stop(function(){\n            console.log('Stoped!')\n        });\n    }, 40000);\n\n  })\n})\n\n```\n\n## Subtitles and Cover\n\nTo include subtitles and a cover image with the media title, use an Object instead of a string in the *play method*:\n\n``` javascript\n\nchromecastjs = require('../')\n\nvar browser = new chromecastjs.Browser()\n\nvar media = {\n    url : 'http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4',\n    subtitles: [{\n        language: 'en-US',\n        url: 'http://carlosguerrero.com/captions_styled.vtt',\n        name: 'English',\n    },\n    {\n        language: 'es-ES',\n        url: 'http://carlosguerrero.com/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: '#FFFFFFFF', // see http://dev.w3.org/csswg/css-color/#hex-notation\n          foregroundColor: '#000FFFF', // see http://dev.w3.org/csswg/css-color/#hex-notation\n          edgeType: 'DROP_SHADOW', // can be: \"NONE\", \"OUTLINE\", \"DROP_SHADOW\", \"RAISED\", \"DEPRESSED\"\n          edgeColor: '#AA00FFFF', // see http://dev.w3.org/csswg/css-color/#hex-notation\n          fontScale: 1.5, // transforms into \"font-size: \" + (fontScale*100) +\"%\"\n          fontStyle: 'BOLD_ITALIC', // can be: \"NORMAL\", \"BOLD\", \"BOLD_ITALIC\", \"ITALIC\",\n          fontFamily: 'Droid Sans',\n          fontGenericFamily: 'CURSIVE', // 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\n\nbrowser.on('deviceOn', function(device){\n  device.connect()\n  device.on('connected', function(){\n\n    // Starting to play Big Buck Bunny (made in Blender) exactly in the first minute without subtitles or cover.\n    //device.play('http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4', 60, function(){\n    //    console.log('Playing in your chromecast!')\n    //});\n\n    // Starting to play Big Buck Bunny (made in Blender) exactly in the first minute with example subtitles and cover.\n    device.play(media, 0, function(){\n        console.log('Playing in your chromecast!')\n\n        setTimeout(function(){\n            console.log('subtitles off!')\n            device.subtitlesOff(function(err,status){\n                if(err) console.log(\"error setting subtitles off...\")\n                console.log(\"subtitles removed.\")\n            });\n        }, 20000);\n\n        setTimeout(function(){\n            console.log('subtitles on!')\n            device.changeSubtitles(1, function(err, status){\n                if(err) console.log(\"error restoring subtitles...\")\n                console.log(\"subtitles restored.\")\n            });\n        }, 25000);\n\n        setTimeout(function(){\n            console.log('subtitles on!')\n            device.changeSubtitles(1, function(err, status){\n                if(err) console.log(\"error restoring subtitles...\")\n                console.log(\"subtitles restored.\")\n            });\n        }, 25000);\n\n        setTimeout(function(){\n            device.pause(function(){\n                console.log('Paused!')\n            });\n        }, 30000);\n\n        setTimeout(function(){\n            device.unpause(function(){\n                console.log('unpaused!')\n            });\n        }, 40000);\n\n        setTimeout(function(){\n            console.log('I ment English subtitles!')\n            device.changeSubtitles(0, function(err, status){\n                if(err) console.log(\"error restoring subtitles...\")\n                console.log(\"English subtitles restored.\")\n            });\n        }, 45000);\n\n        setTimeout(function(){\n            console.log('Increasing subtitles size...')\n            device.changeSubtitlesSize(10, function(err, status){\n                if(err) console.log(\"error increasing subtitles size...\")\n                console.log(\"subtitles size increased.\")\n            });\n        }, 46000);\n\n        setTimeout(function(){\n            device.seek(30,function(){\n                console.log('seeking forward!')\n            });\n        }, 50000);\n\n        setTimeout(function(){\n            console.log('decreasing subtitles size...')\n            device.changeSubtitlesSize(1, function(err, status){\n                if(err) console.log(\"error...\")\n                console.log(\"subtitles size decreased.\")\n            });\n        }, 60000);\n\n        setTimeout(function(){\n            device.pause(function(){\n                console.log('Paused!')\n            });\n        }, 70000);\n\n        setTimeout(function(){\n            device.seek(30,function(){\n                console.log('seeking forward!')\n            });\n        }, 80000);\n\n        setTimeout(function(){\n            device.seek(30,function(){\n                console.log('seeking forward!')\n            });\n        }, 85000);\n\n        setTimeout(function(){\n            device.unpause(function(){\n                console.log('unpaused!')\n            });\n        }, 90000);\n\n\n        setTimeout(function(){\n            device.seek(-30,function(){\n                console.log('seeking backwards!')\n            });\n        }, 100000);\n\n\n        setTimeout(function(){\n            device.stop(function(){\n                console.log('Stoped!')\n            });\n        }, 200000);\n\n    })\n  })\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguerrerocarlos%2Fchromecast-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguerrerocarlos%2Fchromecast-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguerrerocarlos%2Fchromecast-js/lists"}