зеркало из https://github.com/mozilla/popcorn-js.git
Merge commit 'scott/jscommand'
This commit is contained in:
Коммит
4b9ec7695e
|
@ -0,0 +1,40 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="http://code.jquery.com/jquery.js"></script>
|
||||
<script src="../../popcorn.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="videoContainer" style="text-align:center;">
|
||||
<video src="http://scotland.proximity.on.ca/sdowne/dutch.ogg" controls data-timeline-sources="jscommand.xml"></video>
|
||||
</div>
|
||||
<div id="content"><div>
|
||||
<script>
|
||||
var customJS = (function() {
|
||||
var interval;
|
||||
var content = document.getElementById("content");
|
||||
|
||||
function work() {
|
||||
var item = document.createElement("p");
|
||||
item.innerHTML = "working...";
|
||||
content.appendChild(item);
|
||||
}
|
||||
|
||||
return {
|
||||
start: function() {
|
||||
var item = document.createElement("p");
|
||||
item.innerHTML = "starting...";
|
||||
content.appendChild(item);
|
||||
interval = setInterval(work, 1000);
|
||||
},
|
||||
stop: function() {
|
||||
var item = document.createElement("p");
|
||||
item.innerHTML = "done!";
|
||||
content.appendChild(item);
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<popcorn>
|
||||
<timeline>
|
||||
<script in="1" out="10" start="customJS.start" stop="customJS.stop"/>
|
||||
</timeline>
|
||||
</popcorn>
|
23
popcorn.js
23
popcorn.js
|
@ -986,7 +986,23 @@
|
|||
this.videoManager.videoElement.currentTime = this.params.seekto;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Script Command
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Popcorn.ScriptCommand = function(name, params, text, videoManager) {
|
||||
Popcorn.VideoCommand.call(this, name, params, text, videoManager);
|
||||
this.start = eval(this.params.start) || function() {};
|
||||
this.stop = eval(this.params.stop) || function() {};
|
||||
this.onIn = function() {
|
||||
this.start();
|
||||
};
|
||||
this.onOut = function() {
|
||||
this.stop();
|
||||
};
|
||||
};
|
||||
|
||||
// Wrapper for accessing commands by name
|
||||
// commands[name].create() returns a new command of type name
|
||||
// Not sure if this is the best way; maybe it's too fancy?
|
||||
|
@ -1056,6 +1072,11 @@
|
|||
create: function(name, params, text, videoManager) {
|
||||
return new Popcorn.SeekCommand(name, params, text, videoManager);
|
||||
}
|
||||
},
|
||||
script: {
|
||||
create: function(name, params, text, videoManager) {
|
||||
return new Popcorn.ScriptCommand(name, params, text, videoManager);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Двоичные данные
tools/jsshellhelper.pyc
Двоичные данные
tools/jsshellhelper.pyc
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче