├── LICENSE ├── README.md ├── receiver.html └── sender.html /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Sterling DeMille 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # URL Cast Receiver 2 | 3 | **Custom chromecast receiver to display webpages without tab casting** 4 | 5 | Try it with the [sender demo](https://demille.github.io/url-cast-receiver). 6 | 7 | ## Usage 8 | 9 | You can use a hosted version now (use **5CB45E5A** for your appId), 10 | or you can clone / customize this repo and host your own. 11 | 12 | URLs are sent to the receiver by sending messages on the `urn:x-cast:com.url.cast` namespace. 13 | 14 | There are two ways to cast a URL to the reciever, each with pros and cons: 15 | 16 | **Method 1:** Loading the URL in an iframe 17 | - Pros: Reciever stays intact after loading page 18 | - Cons: `X-Frame-Options: SAMEORIGIN` errors 19 | 20 | ```js 21 | // iframe method 22 | var namespace = 'urn:x-cast:com.url.cast'; 23 | var msg = { 24 | "type": "iframe", 25 | "url": "http://example.com" 26 | } 27 | 28 | session.sendMessage(namespace, msg, onSuccess, onErr); 29 | // reciever is still alive 30 | ``` 31 | 32 | **Method 2:** Changing the window location on the chromecast 33 | - Pros: Can load any URL, no iframe origin issues 34 | - Cons: Reciever gets overridden with page load, so you can no longer communicate with it without stopping the cast and restarting. 35 | 36 | ```js 37 | // iframe method 38 | var namespace = 'urn:x-cast:com.url.cast'; 39 | var msg = { 40 | "type": "loc", 41 | "url": "http://example.com" 42 | } 43 | 44 | session.sendMessage(namespace, msg, onSuccess, onErr); 45 | // receiver is now basically dead to you 46 | ``` 47 | 48 | ## Notes 49 | 50 | - The chromecast renders webpages at a viewport size of 1280x720 instead of 1080x1920 like you might expect, so be prepared for that. 51 | 52 | - The default background color on the chromecast is black, so pages loaded with method 2 (the window location) might have a surprise black background. If you use the iframe method, the receiver sets the body to white. 53 | 54 | ## License 55 | 56 | The MIT License (MIT) 57 | 58 | Copyright (c) 2015 Sterling DeMille <sterlingdemille@gmail.com> 59 | 60 | Permission is hereby granted, free of charge, to any person obtaining a copy of 61 | this software and associated documentation files (the "Software"), to deal in 62 | the Software without restriction, including without limitation the rights to 63 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 64 | the Software, and to permit persons to whom the Software is furnished to do so, 65 | subject to the following conditions: 66 | 67 | The above copyright notice and this permission notice shall be included in all 68 | copies or substantial portions of the Software. 69 | 70 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 71 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 72 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 73 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 74 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 75 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /receiver.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | URL Cast Receiver 5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 57 | 58 | -------------------------------------------------------------------------------- /sender.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | URL Cast Demo 5 | 6 | 85 | 86 | 87 | 88 |
89 |

URL Cast Receiver

90 | 91 |

Step 1:

92 | 93 | 94 |

Step 2: Send url

95 | 96 | 97 | 101 | 102 | 103 |

Details

104 |

105 | There are two methods for casting, with pros and cons: 106 | 107 |

    108 |
  1. Load an iframe (You will have trouble loading a url with x-frame-options: same origin.)
  2. 109 |
  3. Change the window location (You will lose control when you load the url over the receiver.)
  4. 110 |
111 | 112 | Also, notice the chromecast viewport is 1280x720 and the default background is black before the receiver loads. 113 |

114 | 115 |

« GitHub

116 |
117 | 118 |
119 | 120 | 121 | 272 | 273 | --------------------------------------------------------------------------------