Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 9025ada

Browse files
committed
update readme for beta v 0.1.0
1 parent 9a8fdf4 commit 9025ada

6 files changed

Lines changed: 13 additions & 14 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<p align="center">
2-
<img src="resources/runway_icon.png" width="95">
3-
<img src="resources/js_icon.png" width="90">
2+
<img src="https://runway.nyc3.digitaloceanspaces.com/assets/github/cover_runway_javascript_github.jpg">
43
</p>
54

65
# Runway + JavaScript
76

8-
A collection of stand alone examples connecting [Runway](https://runwayml.com/) to JavaScript.
9-
Examples are separated by current available models.
7+
A collection of examples and tutorials on how to use [Runway](https://runwayml.com/) with JavaScript applications.
108

119
## Examples
1210

@@ -25,7 +23,7 @@ Examples are separated by current available models.
2523

2624
## Library
2725

28-
Ideally this will become a JavaScript Library that manages the socket connections. For now all examples are using [socket.io](https://socket.io/) to get real-time data. Some examples use [p5.js](https://p5js.org/) to draw things on the canvas.
26+
This will soon become a JavaScript library that manages the connections and data streams with a simple API.
2927

3028
## Contributing
3129

im2txt/receivesOnly/script.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
// Create a connection to the Runway HTTP Server
3232
// You should select Camera from the Input Panel
3333
// *You should update this address to match the URL provided by the app
34-
var socket = io.connect('http://127.0.0.1:3333');
34+
var socket = io.connect('http://127.0.0.1:33000');
3535

3636
// Wait until the page is loaded
3737
document.addEventListener("DOMContentLoaded", function(event) {
@@ -47,6 +47,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
4747

4848
// When there is a data event, update the log element
4949
socket.on('data', function(data) {
50-
log.innerHTML = data.results[0].caption;
50+
console.log(data);
51+
// log.innerHTML = data.results[0].caption;
5152
});
5253
});

im2txt/sendWebcam/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h2>im2txt Demo: sending live webcam stream to Runway</h2>
5959

6060
<!-- Camera -->
6161
<h3>Camera</h3>
62-
<video width="300" height="280"></video>
62+
<video width="300" height="280" muted="muted"></video>
6363

6464
<!-- Canvas: Just to send base64 images to Runway -->
6565
<canvas width="300" height="280" style="display: none;"></canvas>

im2txt/sendWebcam/script.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// Create a connection to the Runway HTTP Server
3131
// You should select HTTP from the INPUT Panel
3232
// *You should update this address to match the URL provided by the app
33-
var socket = io.connect('http://127.0.0.1:33100/query');
33+
var socket = io.connect('http://127.0.0.1:3000/');
3434

3535
// Wait until the page is loaded
3636
document.addEventListener("DOMContentLoaded", function(event) {
@@ -49,7 +49,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
4949
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
5050
navigator.mediaDevices.getUserMedia({ video: true })
5151
.then((stream) => {
52-
video.src = window.URL.createObjectURL(stream);
52+
video.srcObject = stream;
5353
video.play();
5454
});
5555
}
@@ -60,8 +60,8 @@ document.addEventListener("DOMContentLoaded", function(event) {
6060
});
6161

6262
// When there is new data coming in, update the log element
63-
socket.on('update_response', function(data) {
64-
log.innerHTML = data.results[0].caption;
63+
socket.on('data', function(data) {
64+
log.innerHTML = data;
6565
if (shouldLoop) {
6666
sendImage();
6767
}
@@ -71,8 +71,8 @@ document.addEventListener("DOMContentLoaded", function(event) {
7171
function sendImage() {
7272
ctx.drawImage(video, 0, 0, 300, 280);
7373
// Send to Runway the current element in the canvas
74-
socket.emit('update_request', {
75-
data: canvas.toDataURL('image/jpeg')
74+
socket.emit('query', {
75+
image: canvas.toDataURL('image/jpeg')
7676
});
7777
}
7878

resources/js_icon.png

-10 KB
Binary file not shown.

resources/runway_icon.png

-16.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)