Skip to content

Commit

Permalink
v0.2.1-unmodified
Browse files Browse the repository at this point in the history
  • Loading branch information
warren-bank committed Jul 16, 2018
0 parents commit 6b31da5
Show file tree
Hide file tree
Showing 42 changed files with 1,027 additions and 0 deletions.
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
### [crx-webcast-reloaded](https://github.com/warren-bank/crx-webcast-reloaded)

#### Background:

* [WebCast](https://chrome.google.com/webstore/detail/webcast/gmenldaghgogpiajaipajaphcjbankna?hl=en) is a really nice enhancement for the Google Chrome desktop web browser
* Its purpose is to identify embedded video files on a webpage that are encoded in a format supported by Google Chromecast, and provide a mechanism by which to cast their links
* when a link is "cast", Chromecast use its embedded HTML5 browser to play the video
* the device which was used to "cast" the link doesn't proxy the stream
* The tool consists of two parts:
* an external website
* an AngularJS SPA (single page app)
* the default route allows a user to enter the URL to a video file (in a format supported by Google Chromecast)
* another route can be passed a base64 encoded URL to a video file (in a format supported by Google Chromecast)
* after a URL is received, the following page elements are rendered:
* an HTML5 video player
* a Chromecast button, which used some Google APIs to scan for Chromecasts on the LAN and display a list of devices that could be used to play the video file
* a Chrome extension
* it hooks into the HTTP API to listen for requested URLs that end with a supported file extension
* each URL that matches is made available to "cast"
* clicking on any such video will open a new browser tab to WebCast's external website component
* it's provided with the base64 encoded URL of the video file

#### Status:

* [WebCast](https://chrome.google.com/webstore/detail/webcast/gmenldaghgogpiajaipajaphcjbankna?hl=en) hasn't been updated since:
* version 0.2.1
* June 2, 2014
* It tests for the following file extensions:
* .mp4
* .mov

#### Issues:

* [Supported Media for Google Cast](https://developers.google.com/cast/docs/media):
* not supported:
* .mov
* is supported:
* .webm
* Google Chrome will prefer .webm to .mp4
* if a video tag has sourced for both formats
* only the .webm video file will be requested
* the Chrome extension won't detect the URL of this video file

#### Purpose for Fork:

* support .webm
* keep a backup of the "external website"

#### Additional Notes:

* the "external website":
* can be used without any Chrome extension
* the URL to cast would need to be manually entered into a form field
* can be loaded into the Google Chrome desktop web browser from the local filesystem
* ex: `file:///C:/PortableApps/webcast-reloaded/external_website/index.html#/watch/aHR0cDovL3RlY2hzbGlkZXMuY29tL2RlbW9zL3NhbXBsZS12aWRlb3Mvc21hbGwubXA0`
* no server is required
* [link to canonical host](http://web-cast.appspot.com/)
* [link to github mirror](http://warren-bank.github.io/crx-webcast-reloaded/external_website/index.html)

#### Possible To-Dos:

* add an option to the Chrome extension that allows the user to change the URL of the "external website"
* change the methodology used by the Chrome extension to detect matching video files
* inspect the HTTP response "Content-Type" header

#### Links to Related Apps for Android:

* [EZ Web Video Cast](https://play.google.com/store/apps/details?id=com.hecorat.videocast)
* a minimal app that doesn't have ads and works great

#### Legal:

* copyright: original author of [WebCast](https://chrome.google.com/webstore/detail/webcast/gmenldaghgogpiajaipajaphcjbankna?hl=en)
* license: unknown
218 changes: 218 additions & 0 deletions chrome_extension/angular.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions chrome_extension/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Web Cast Background</title>
</head>
<body>
<video id="video"></video>
<canvas id="canvas" width="200" height="130"></canvas>
</body>
<script src="background.js"></script>
</html>
7 changes: 7 additions & 0 deletions chrome_extension/background.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added chrome_extension/data/favicon.ico
Binary file not shown.
Binary file added chrome_extension/data/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome_extension/data/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome_extension/data/icon19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome_extension/data/icon38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome_extension/data/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chrome_extension/data/noimage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions chrome_extension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"update_url": "https://clients2.google.com/service/update2/crx",

"name": "WebCast",
"short_name": "WebCast",
"version": "0.2.1",
"description": "Finds videos in the web page you're on and allows to send them to Chromecast.",
"icons": {
"128": "data/icon128.png",
"16": "data/icon16.png",
"48": "data/icon48.png"

},
"background": {
"page": "background.html"
},
"page_action": {
"default_name": "Web cast",
"default_icon": {
"19": "data/icon19.png",
"38": "data/icon38.png"
},
"default_popup": "popup.html"
},
"permissions": [
"webRequest",
"tabs",
"http://*/*",
"https://*/*"
],
"content_security_policy": "default-src 'self'; media-src http://*:* https://*:*; img-src 'self' 'unsafe' 'unsafe-inline' data: ;style-src 'self' 'unsafe-inline' http://fonts.googleapis.com; script-src 'self'; connect-src 'self' http://*:* https://*:* ws://*:*; font-src http://themes.googleusercontent.com; object-src 'none'",
"web_accessible_resources" : ["castApp.js", "popup.html", "popup.js", "/data/noimage.jpg"],
"manifest_version": 2
}
77 changes: 77 additions & 0 deletions chrome_extension/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
body {
background-color: #FFF;
color: #B2B2B2;
font-size: 14px;
font-family: 'Roboto', "OpenSans", "Verdana", Georgia, Serif;
}

#video, #canvas {
display: none;
}

#links {
margin: 10px 0;
max-height: 200px;
overflow-y: auto;
overflow-x: hidden;
}

.page-summary {
color: #B2B2B2;
font-size: 16px;
margin-bottom: 10px;

}

.video-item {
overflow: hidden;
width: 450px;
margin-bottom: 10px;
}

.video-preview {
width: 100px;
height: 60px;
float: left;
display: block;
margin-right: 20px;
}

.video-link {
font-size: 11px;
display: block;
width: 300px;
color: #B2B2B2;
float: left;
word-wrap: break-word;
max-height: 54px;
overflow: hidden;
}

::-webkit-scrollbar {
height: 12px;
width: 12px;
background: #FBFBFB;
}

::-webkit-scrollbar-thumb {
background: #F5F5F5;
border-radius: 1px;
}

::-webkit-scrollbar-corner {
background: #FBFBFB;
}

button {
background: #fff;
font-size: 14px;
border: 1px #f5f5f5 solid;
color: #B2B2B2;
transition: border 1s;
cursor: pointer;
}

button:hover {
border: 1px #B2B2B2 solid;
}
23 changes: 23 additions & 0 deletions chrome_extension/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html ng-app="project">
<head>
<title>Web Cast</title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&amp;subset=latin" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="popup.css">
<script src="angular.min.js"></script>
<script src="popup.js"></script>
</head>
<body ng-controller="WebCast">
<div class="page-summary">Videos detected on the page #{{links.length}}</div>
<div>Click on a video link to play it or send to Chromecast.</div>
<div id="links">
<div data-ng-repeat="link in links" class="video-item">
<img src="{{link.img}}" class="video-preview" id="{{link.id}}" >
<a href="{{link.link}}" class="video-link" target="_blank" title="{{link.original}}">{{link.title}}</a>
</div>
</div>
<div><button data-ng-click="clearAll()">Clear videos list</button></div>
</body>
</html>


51 changes: 51 additions & 0 deletions chrome_extension/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
angular.module('project', [])
.config([
'$compileProvider',
function( $compileProvider )
{
// Angular -1.2.0-rc2 : /^\s*(https?|ftp|file):|data:image\//
var currentImgSrcSanitizationWhitelist = $compileProvider.imgSrcSanitizationWhitelist();
var newImgSrcSanitizationWhiteList = currentImgSrcSanitizationWhitelist.toString().slice(0,-1)+'|chrome-extension:|filesystem:chrome-extension:'+'|blob:chrome-extension%3A'+currentImgSrcSanitizationWhitelist.toString().slice(-1);
$compileProvider.imgSrcSanitizationWhitelist(newImgSrcSanitizationWhiteList);
}
])
.controller('WebCast', function($scope) {
var tabId = undefined;
$scope.links = [];
chrome.tabs.query({active: true, lastFocusedWindow: true},
function(array_of_Tabs) {
var tab = array_of_Tabs[0];
tabId = tab.id;
addLinks(chrome.extension.getBackgroundPage().tabUrls[tab.id]);
});
function addLinks(links) {
screenshots = chrome.extension.getBackgroundPage().tabScreenshots[tabId] || {};
for(v in links) {
var link = links[v].trim();
var title = link;
var index = title.indexOf(".mp4");
if (index == -1) {
index = title.indexOf(".mov");
}
title = link.substring(0, index+4);
$scope.links.push({
'img': screenshots[link] ? screenshots[link] : "data/noimage.jpg",
'id': encodeLink(link),
'link': "http://web-cast.appspot.com/#/watch/" + encodeURIComponent(encodeLink(link)),
'title': title,
'original': link
});
}
$scope.$digest();
}

$scope.clearAll = function() {
chrome.extension.getBackgroundPage().clearLinksForTab(tabId);
window.close();
}

function encodeLink(str) {
return encodeURIComponent(
window.btoa(unescape(encodeURIComponent( str ))));
}
});
Loading

0 comments on commit 6b31da5

Please sign in to comment.