Skip to content

Commit

Permalink
Merge pull request #402 from ebu/release/2.0
Browse files Browse the repository at this point in the history
Merge Release/2.0 to master. Actually ups to v2.0.1
  • Loading branch information
nigelmegitt authored Mar 31, 2017
2 parents 85a1766 + 8645b64 commit 294fec6
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 89 deletions.
135 changes: 135 additions & 0 deletions ebu_tt_live/ui/test/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script type="text/javascript">
var sock = null;
var ellog = null;
var websocket_url_input = null;
var sequence_input = null;

/************************************************** Helper functions ******************************************/
function notifyError(element, notification, fade_out) {
element.css("color", "red");
element.text(notification);
if (fade_out)
setTimeout(function () { element.text(""); }, 3000);
}

function notifyWarning(element, notification, fade_out) {
element.css("color", "orange");
element.text(notification);
if (fade_out)
setTimeout(function () { element.text(""); }, 3000);
}

function notifySuccess(element, notification, fade_out) {
element.css("color", "green");
element.text(notification);
if (fade_out)
setTimeout(function () { element.text(""); }, 3000);
}

function connect() {

if (sock) {
sock.close();
return;
}

wsuri = websocket_url_input.value + '/' + sequence_input.value + '/subscribe';

if ("WebSocket" in window) {
sock = new WebSocket(wsuri);
} else if ("MozWebSocket" in window) {
sock = new MozWebSocket(wsuri);
} else {
log("Browser does not support WebSocket!");
}

if (sock) {
sock.onopen = function() {
log("Connected to " + wsuri);
$("#websocket-connect-button").hide();
$("#websocket-disconnect-button").show();
notifySuccess($("#websocket-notifications-span"), "Connected to websocket server", false);
}

sock.onclose = function(e) {
notifyWarning($("#websocket-notifications-span"), "Connection to websocket server closed.", false);
log("Connection closed (wasClean = " + e.wasClean + ", code = " + e.code + ", reason = '" + e.reason + "')");
sock = null;
$("#websocket-connect-button").show();
$("#websocket-disconnect-button").hide();
}

sock.onmessage = function(e) {
log(e.data);
socket.connected = false;
socket.websocket = null;
$("#websocket-connect-button").show();
$("#websocket-disconnect-button").hide();
}

sock.onerror = function(evt) {
console.log(evt);
}
}

}

function disconnect() {
if (sock) {
sock.close();
}


}

window.onload = function() {

var wsuri;
ellog = document.getElementById('log');
websocket_url_input = document.getElementById('websocket-url-input');
sequence_input = document.getElementById('sequence-input');
};

function log(m) {
ellog.textContent = m + '\n';
ellog.scrollTop = 0;
};
</script>
<link rel="stylesheet" href="../assets/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="../assets/css/custom.min.css" media="screen">
<link rel="stylesheet" href="../assets/css/main.css" media="screen">
<link rel="stylesheet" href="../assets/css/test-style.css" media="screen">
</head>
<body>
<div id="header">
<a href="https://tech.ebu.ch/home"><img src="../assets/img/ebu-logo-relaunch.png"/></a>
<h1><a href="http://ebu.github.io/ebu-tt-live-toolkit/">EBU-TT Live Interoperability Toolkit</a></h1>
<h3>This is the WebSocket Test document viewer.</h3>
It subscribes to a sequence of Part 3 documents on a WebSocket connection and displays each document as it arrives.
</div>
<div>
<noscript>You must enable JavaScript</noscript>

<div id="websocket-url-div" class="control-section-div">
<span class="control-section-header-span">Connection</span>
<label for="websocket-url-input">Websocket URL: </label>
<input type="url" id="websocket-url-input" name="websocket-url-input" value="ws://127.0.0.1:9000" required>
<span> / </span><label for="sequence-selector">Sequence: </label>
<input type="text" id="sequence-input" name="sequence-input" value="TestSequence1"></select>
<span> / subscribe </span>
<button type="button" id="websocket-connect-button" name="websocket-connect-button" onclick='connect();'>Connect</button>
<button type="button" id="websocket-disconnect-button" name="websocket-disconnect-button" style="display: none;" onclick='disconnect();'>Disconnect</button>
<span id="websocket-notifications-span" style="color: orange">Disconnected</span>
</div>
<form action="" id="subtitle-form">

<div>
<pre id="log" style="height: 30em; overflow-y: scroll; background-color: #faa;"></pre>
</div>
</div>
</body>
</html>
18 changes: 9 additions & 9 deletions ebu_tt_live/ui/user_input_producer/user_input_producer.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ <h3>This is the User Input Producer (UIP).</h3>
It streams a sequence of Part 3 documents on a WebSocket connection.
</div>

<div id="sequence-slector-div" class="control-section-div">
<div id="sequence-selector-div" class="control-section-div">
<span class="control-section-header-span">Manage Sequences</span>
<button type="button" id="create-new-sequence-button" name="create-new-sequence-button">Create a new sequence</button>
<button type="button" id="create-new-sequence-button" name="create-new-sequence-button">Create a new sequence</button>
<div id="new-sequence-div" style="display: none">
<label for="new-sequence-identifier-input">Sequence Identifier: </label>
<input type="text" name="new-sequence-identifier-input" id="new-sequence-identifier-input">
<label for ="time-base-selector">Time base : </label>
<select id="time-base-selector" name="time-base-selector">
<option value="clock" selected="selected">Clock</option>
<option value="media">Media</option>
<!-- Disabling for demo
<!-- Disabling for demo
<option value="smpte">SMPTE</option>
-->
</select>
Expand Down Expand Up @@ -83,7 +83,7 @@ <h3>This is the User Input Producer (UIP).</h3>
<span class="control-section-header-span">Send Document </span>
<button type="button" name="submit-subtitle-button" id="submit-subtitle-button">Now!</button>
<span>&nbsp;&nbsp;</span>
<input type="radio" name="sending-type-radio-input" id="radio_send" value="live" checked> on enter, space and escape
<input type="radio" name="sending-type-radio-input" id="radio_send" value="live" checked> on enter, space and escape
&nbsp;
<input type="radio" name="sending-type-radio-input" id="radio_schedule" value="scheduled_send"> on scheduled time
&nbsp;
Expand Down Expand Up @@ -343,7 +343,7 @@ <h3>This is the User Input Producer (UIP).</h3>
// We are not expecting any messages back - close the connection!
socket.websocket.close();

notifyError($('#subtitle-form-notification-div'), "Unexpected message from server!", false);
notifyError($('#subtitle-form-notification-div'), "Unexpected message from server!", false);
}


Expand Down Expand Up @@ -601,14 +601,14 @@ <h3>This is the User Input Producer (UIP).</h3>

// keyboard shortcut: Enter, space and escape send a document, escape also clears the text box.
// Enter, space and escape send a document only in "Send button" mode.
// Escape always clears. Enter removes previous lines according to the max-lines setting, after sending.
// Escape always clears. Enter removes previous lines according to the max-lines setting, after sending.
// Not tested in Safari
$("#subtitle-content-textarea").keydown( function(evt) {
var keyCode = evt.which;
var isSendButton = document.getElementById('radio_send').checked;
if (isSendButton){
if (keyCode == 13 || keyCode == 32 || keyCode == 27) {sendDocument();}
}
}
if (keyCode == 27) {
// Escape clears the text area
document.getElementById('subtitle-content-textarea').value = "";
Expand All @@ -619,9 +619,9 @@ <h3>This is the User Input Producer (UIP).</h3>
var new_text_arr = $("#subtitle-content-textarea").val().split(/\r?\n|\r/);
while (new_text_arr.length >= max_lines) { new_text_arr.shift(); };
$("#subtitle-content-textarea").val(new_text_arr.join('\r\n'));
}
}
});

// In the special case that max-lines is 1 clear the text area on Enter key up otherwise
// an extra unwanted carriage return line feed pair is added at the beginning.
$("#subtitle-content-textarea").keyup( function(evt) {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

setup(
name="ebu-tt-live",
version="2.0",
version="2.0.1",
description="EBU-TT Part 3 library implementing Specification EBU-3370",
install_requires=[
"PyXB",
Expand Down
79 changes: 0 additions & 79 deletions test.html

This file was deleted.

0 comments on commit 294fec6

Please sign in to comment.