Skip to content

Commit

Permalink
Merge branch 'hosted_devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
guancio committed Oct 10, 2013
2 parents aa7daab + dcaceae commit 39c3789
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 56 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Change log:
- Version 1.4.0
- Experimental support of opensubtitles.org (currently allowing to
download only english subtitles)
- Renable the hosted version (no support for opensubtitles due to cross domain)
- Version 1.3.0
- Restyle of the subtitle interface
- Allows to select the subtitle from a zip file containing several entries
Expand Down
1 change: 1 addition & 0 deletions host/content
2 changes: 2 additions & 0 deletions host/minimal_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
python -m SimpleHTTPServer
Binary file added hostedapp/camera.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions hostedapp/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Subtitle Videoplayer Hosted",
"version": "1.4.0",
"manifest_version": 2,
"icons": {
"16": "camera.png",
"128": "camera.png"
},
"app": {
"urls": [
"http://localhost"
],
"launch": {
"web_url": "http://localhost:8000/content/index.html"
}
},
"offline_enabled": true
}
18 changes: 18 additions & 0 deletions hostedapp/manifest_dell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Subtitle Videoplayer Hosted",
"version": "1.4.0",
"manifest_version": 2,
"icons": {
"16": "camera.png",
"128": "camera.png"
},
"app": {
"urls": [
"http://localhost"
],
"launch": {
"web_url": "http://localhost:8000/content/index.html"
}
},
"offline_enabled": true
}
18 changes: 18 additions & 0 deletions hostedapp/manifest_git.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Subtitle Videoplayer",
"version": "1.4.0",
"manifest_version": 2,
"icons": {
"16": "camera.png",
"128": "camera.png"
},
"app": {
"urls": [
"https://rawgithub.com/guancio/ChromeOsSubtitle/hosted/src/"
],
"launch": {
"web_url": "https://rawgithub.com/guancio/ChromeOsSubtitle/hosted/src/index.html"
}
},
"offline_enabled": true
}
43 changes: 43 additions & 0 deletions src/appcache
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
CACHE MANIFEST
# version 1.4.0.e
background.png
index.html
mediaelementplayer.min.css
bigplay.png
loading.gif
controls-wmp.png
controls.svg
background.js
js/app.js
js/jquery.js
lib/zip.js
lib/inflate.js
js/me-header.js
js/me-namespace.js
js/me-utility.js
js/me-plugindetector.js
js/me-featuredetection.js
js/me-mediaelements.js
js/me-shim.js
js/me-i18n.js
js/mep-header.js
js/mep-library.js
js/mep-player.js
js/mep-feature-playpause.js
js/mep-feature-stop.js
js/mep-feature-progress.js
js/mep-feature-time.js
js/mep-feature-volume.js
js/mep-feature-fullscreen.js
js/mep-feature-tracks.js
controls-wmp-bg.png
controls.png
controls-ted.png
bigplay.svg
icon.png
lib/Long.min.js
lib/opensubtitlehash.js
js/opensubtitle.js
opensubtitle.gif
lib/rpc.js

4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
<div id="main">
</div>

<script src="js/jquery.js"></script>
<script src="js/jquery.js"></script>

<script src="lib/zip.js"></script>
<script src="lib/rpc.js"></script>
<script src="test/opensubtitle.js"></script>

<script src="js/me-header.js"></script>
<script src="js/me-namespace.js"></script>
Expand Down Expand Up @@ -41,6 +40,7 @@
<script src="js/opensubtitle.js"></script>

<script src="js/app.js"></script>

</body>
</html>

45 changes: 25 additions & 20 deletions src/js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var myURL = window.URL || window.webkitURL;

var packaged_app = (window.location.origin.indexOf("chrome-extension") == 0);

MediaElementPlayer.prototype.buildsubsize = function(player, controls, layers, media) {
var captionSelector = player.captionsButton.find('.mejs-captions-selector');
var
Expand Down Expand Up @@ -104,29 +106,28 @@ MediaElementPlayer.prototype.buildsubdelay = function(player, controls, layers,
$.extend(MediaElementPlayer.prototype, {
buildsource: function(player, controls, layers, media) {
var
t = this;
t = this,
openFileInput = $('<input style="display:none" type="file" id="openfile_input"/>')
.appendTo(controls);
t.openedFile = null;
var open =
$('<div class="mejs-button mejs-source-button mejs-source" >' +
'<button type="button" aria-controls="' + t.id + '" title="' + mejs.i18n.t('Open video...') + '" aria-label="' + mejs.i18n.t('Open video...') + '"></button>' +
'</div>')
.appendTo(controls)
.click(function(e) {
e.preventDefault();

chrome.fileSystem.chooseEntry({type: 'openFile'}, function(theFileEntry) {
if (theFileEntry == null)
return;
mainMediaElement.stop();
player.tracks = [];
theFileEntry.file(function fff(file) {
t.openedFile = file;
var path = window.URL.createObjectURL(file);
mainMediaElement.setSrc(path);
});
});
return false;
});
.appendTo(controls);
open.click(function(e) {
e.preventDefault();
openFileInput[0].click();
return false;
});
openFileInput.change(function (e) {
mainMediaElement.stop();
player.tracks = [];
var path = window.URL.createObjectURL(openFileInput[0].files[0]);
t.openedFile = openFileInput[0].files[0];
mainMediaElement.setSrc(path);
return false;
});
}
});
})(mejs.$);
Expand Down Expand Up @@ -238,13 +239,17 @@ var mainMediaElement = null;

// $('#main').append('<video width="1024" height="590" id="player" controls="controls"></video>');
$('#main').append('<video id="player" controls="controls"></video>');

var features = ['source', 'playpause','progress','current','duration', 'tracks','subdelay', 'subsize', 'volume', 'info', 'fullscreen', 'drop'];
if (packaged_app)
features.push('opensubtitle');

$('#player').mediaelementplayer({
startLanguage:'en',
isVideo:true,
hideCaptionsButtonWhenEmpty:false,
mode:"native",
features: ['source', 'playpause','progress','current','duration', 'tracks','subdelay', 'subsize', 'volume', 'info', 'fullscreen',
'drop', 'opensubtitle'],
features: features,
success: function (mediaElement, domObject) {
mainMediaElement = mediaElement;

Expand Down
20 changes: 12 additions & 8 deletions src/js/mep-feature-tracks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

zip.workerScriptsPath = "/lib/";
zip.workerScriptsPath = "lib/";

(function($) {

Expand Down Expand Up @@ -128,6 +128,7 @@ zip.workerScriptsPath = "/lib/";
'<div class="mejs-button mejs-captionload" >' +
'<button type="button" aria-controls="' + t.id + '" title="' + mejs.i18n.t('Load subtitle...') + '" aria-label="' + mejs.i18n.t('Load subtitle...') + '"></button>' +
'</div>'+
'<input style="display:none" type="file" id="opensrtfile_input"/>' +
'<select id="select_srtname" style="padding: 0px 0px 0px 0px;text-overflow: ellipsis;width: 105px;height: 18px;overflow: hidden;white-space: nowrap;left:60px;position:absolute;visibility:hidden"/>'+
'<label id="label_srtname" style="padding: 0px 0px 0px 0px;text-overflow: ellipsis;width: 105px;height: 18px;overflow: hidden;white-space: nowrap;left:60px;position:absolute;">No subtitle</label>'+
'</li>' +
Expand All @@ -153,15 +154,18 @@ zip.workerScriptsPath = "/lib/";
player.tracks[selectedIdx].isLoaded = false;
player.loadTrack(selectedIdx);
});
var srtFileInputs = player.captionsButton.find('#opensrtfile_input');
srtFileInputs.change(function (e) {
e.preventDefault();
if (srtFileInputs[0].files.length != 1)
return false;

player.openSrtEntry(srtFileInputs[0].files[0]);
return false;
});
player.captionsButton.find('.mejs-captionload button').click(function(e) {
e.preventDefault();
chrome.fileSystem.chooseEntry({type: 'openFile'}, function(theFileEntry) {
if (theFileEntry == null)
return;
theFileEntry.file(function fff(file) {
player.openSrtEntry(file);
});
});
srtFileInputs[0].click();
return false;
});

Expand Down
26 changes: 0 additions & 26 deletions src/manifest.json

This file was deleted.

0 comments on commit 39c3789

Please sign in to comment.