Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newbie question. how can i get videostream off the bebop #14

Closed
adhamalkhaja opened this issue Dec 19, 2015 · 30 comments
Closed

newbie question. how can i get videostream off the bebop #14

adhamalkhaja opened this issue Dec 19, 2015 · 30 comments

Comments

@adhamalkhaja
Copy link

Hello,

i wanted to know how can i get live video stream on an http local host?

and any references i can learn from?

thanks

@johan-olsson
Copy link
Contributor

I think you will find this issue helpful #9

@adhamalkhaja
Copy link
Author

Hello Johan,

I tried the code as you told me to but i am getting the following error.
may you please help me identify the source of the error.

[image: Inline image 1]

On Thu, Dec 24, 2015 at 7:27 PM, Johan Olsson [email protected]
wrote:

I think you will find this issue helpful #9
#9


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

@uaedronemaster Think your image failed to upload or something.

@adhamalkhaja
Copy link
Author

I havent installed emscripton thou, its not mandatory right! plus is there
an issue with the code ?

On Thu, Dec 31, 2015 at 8:27 PM, Johan Olsson [email protected]
wrote:

@uaedronemaster https://github.com/uaedronemaster Think your image
failed to upload or something.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

No it shouldn't be. But I meant that I can't see the image you posted of your error in your previous comment.

@adhamalkhaja
Copy link
Author

well do u see it now?

On Thu, Dec 31, 2015 at 8:57 PM, Adham Al-Khaja [email protected]
wrote:

On Thu, Dec 31, 2015 at 8:47 PM, Adham Al-Khaja [email protected]
wrote:

I havent installed emscripton thou, its not mandatory right! plus is
there an issue with the code ?

On Thu, Dec 31, 2015 at 8:27 PM, Johan Olsson [email protected]
wrote:

@uaedronemaster https://github.com/uaedronemaster Think your image
failed to upload or something.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

Does look like you haven't installed node-bebop. did you run npm install node-bebop?

@adhamalkhaja
Copy link
Author

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson [email protected]
wrote:

Does look like you haven't installed node-bebop. did you run npm install
node-bebop?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@adhamalkhaja
Copy link
Author

i installed it locally now it says 'Broadway-masterPlayerPlayer' module is
not found.... what is that

On Thu, Dec 31, 2015 at 9:37 PM, Adham Al-Khaja [email protected]
wrote:

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson [email protected]
wrote:

Does look like you haven't installed node-bebop. did you run npm install
node-bebop?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

Install it locally and try again. You shouldn't install it globally

@adhamalkhaja
Copy link
Author

Yes i did ... i got a new error now

On Thu, Dec 31, 2015 at 9:42 PM, Adham Al-Khaja [email protected]
wrote:

i installed it locally now it says 'Broadway-masterPlayerPlayer' module is
not found.... what is that

On Thu, Dec 31, 2015 at 9:37 PM, Adham Al-Khaja [email protected]
wrote:

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson [email protected]
wrote:

Does look like you haven't installed node-bebop. did you run npm
install node-bebop?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@adhamalkhaja
Copy link
Author

I posted the new error picture

On Thu, Dec 31, 2015 at 9:44 PM, Adham Al-Khaja [email protected]
wrote:

Yes i did ... i got a new error now

On Thu, Dec 31, 2015 at 9:42 PM, Adham Al-Khaja [email protected]
wrote:

i installed it locally now it says 'Broadway-masterPlayerPlayer' module
is not found.... what is that

On Thu, Dec 31, 2015 at 9:37 PM, Adham Al-Khaja [email protected]
wrote:

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson [email protected]
wrote:

Does look like you haven't installed node-bebop. did you run npm
install node-bebop?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

Maybe it's easier if you just post your code and I can have a look at it.

@adhamalkhaja
Copy link
Author

this is the code:

var bebop = require('node-bebop');
var Player = require('./Broadway-master/Player/Player');
var Drone = bebop.createClient();
var stream = Drone.getVideoStream();

var player = new Player({
useWorker: true,
workerFile: './NodejsConsoleApp3/Broadway-master/Player/Decoder.js'
});

document.body.appendChild(player.canvas);

var toUint8Array = function (parStr) {
var raw = atob(parStr);
var array = new Uint8Array(new ArrayBuffer(raw.length));

Array.prototype.forEach.call(raw, function (data, index) {
    array[index] = raw.charCodeAt(index);
})

return array;

};

stream.on('data', function (data) {
player.decode(toUint8Array(data.toString('base64')));
});

On Fri, Jan 1, 2016 at 6:24 PM, Johan Olsson [email protected]
wrote:

Maybe it's easier if you just post your code and I can have a look at it.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

Doesn't seem to be anything wrong with this assuming the paths are correct and you are creating an Electron app or similar. Is this the case?

@adhamalkhaja
Copy link
Author

no i am not making and electron app.. what is that and am i suppose to make
an electron app to get the video live steam?

On Sun, Jan 3, 2016 at 9:40 PM, Johan Olsson [email protected]
wrote:

Doesn't seem to be anything wrong with this assuming the paths are correct
and you are creating an Electron app or similar. Is this the case?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@adhamalkhaja
Copy link
Author

I downloaded electron, but what should i do exactly? i am dragging and
dropping the visual studio .sln file in electron but it gives me an error?

On Sat, Jan 2, 2016 at 2:34 PM, Adham Al-Khaja [email protected] wrote:

this is the code:

var bebop = require('node-bebop');
var Player = require('./Broadway-master/Player/Player');
var Drone = bebop.createClient();
var stream = Drone.getVideoStream();

var player = new Player({
useWorker: true,
workerFile: './NodejsConsoleApp3/Broadway-master/Player/Decoder.js'
});

document.body.appendChild(player.canvas);

var toUint8Array = function (parStr) {
var raw = atob(parStr);
var array = new Uint8Array(new ArrayBuffer(raw.length));

Array.prototype.forEach.call(raw, function (data, index) {
    array[index] = raw.charCodeAt(index);
})

return array;

};

stream.on('data', function (data) {
player.decode(toUint8Array(data.toString('base64')));
});

On Fri, Jan 1, 2016 at 6:24 PM, Johan Olsson [email protected]
wrote:

Maybe it's easier if you just post your code and I can have a look at it.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@deadprogram
Copy link
Member

@uaedronemaster I would not worry about Electron at this point, that was I think just a general question.

@johan-olsson
Copy link
Contributor

Alright, in that case you have to divide the code to backend nodejs and client js with Broadway. Something like this should work assuming you are using browserify for the client.

Node part:

var io = require('socket.io')(80);
var bebop = require('node-bebop');
var Drone = bebop.createClient();
var stream = Drone.getVideoStream();

var toUint8Array = function (parStr) {
  var raw = atob(parStr);
  var array = new Uint8Array(new ArrayBuffer(raw.length));

  Array.prototype.forEach.call(raw, function (data, index) {
    array[index] = raw.charCodeAt(index);
  })

  return array;
};

io.on('connection', function (socket) {
  stream.on('data', function (data) {
    socket.emit('data', {
      base64: toUint8Array(data.toString('base64'))
    });
  });
});

Client part:

var Player = require('./Broadway-master/Player/Player');
var player = new Player({
  useWorker: true,
  workerFile: './NodejsConsoleApp3/Broadway-master/Player/Decoder.js'
});

document.body.appendChild(player.canvas);


var socket = io('http://localhost/');
socket.on('data', function (data) {
  player.decode(data.base64);
});

@johan-olsson
Copy link
Contributor

@uaedronemaster I created a project for you to clone if you want an example on how to get it running.

@adhamalkhaja
Copy link
Author

Everything works well now including gulp watch... but the only problem is
that bufferutil module and utf8 cant be installed... it says error with
node-gyp rebuild ... cannot install optional dependencies. can you tell me
the version of nodejs and npm you are using ? thank you

On Fri, Jan 8, 2016 at 2:19 PM, Adham Al-Khaja [email protected] wrote:

Thanks!! but just one last question... i ran the app.js using node and it
works and connects to the drone.... but where can i watch my live video
feed? i dont know where to type gulp-watch ..... i downloaded the chrome
extension which is the gulp-devtools but is that related ?

On Fri, Jan 8, 2016 at 1:09 AM, Johan Olsson [email protected]
wrote:

@uaedronemaster https://github.com/uaedronemaster I created a project
https://github.com/johan-olsson/bebopBrowserVideo for you to clone if
you want an example on how to get it running.


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

What bufferutil and utf8 can't be installed? Could you show me your installation error?

@adhamalkhaja
Copy link
Author

this is the error i get :

Microsoft Windows Version 10.0.10586 2015 Microsoft Corporation. All rights reserved.

[21:33:12] Using gulpfile ~\Desktop\Robotics\Parrot
Bebop\bebopBrowserVideo-master\gulpfile.js
[21:33:12] Starting 'html'...
[21:33:12] Starting 'broadway'...
[21:33:12] Starting 'fonts'...
[21:33:12] Finished 'fonts' after 77 μs
[21:33:12] Starting 'clean'...
[21:33:12] Finished 'clean' after 120 ms
[21:33:12] Starting 'moveCss'...
[21:33:12] Finished 'moveCss' after 1.84 ms
[21:33:12] Starting 'styles'...
[21:33:12] Finished 'styles' after 6.67 μs
[21:33:12] Starting 'scripts'...
[21:33:12] Starting 'bower'...
[21:33:12] Finished 'bower' after 4.62 μs
[21:33:12] all files 991 B
[21:33:12] Finished 'html' after 372 ms
[21:33:12] Finished 'broadway' after 189 ms
[BABEL] Note: The code generator has deoptimised the styling of
"C:/Users/Desktop/Robotics/Parrot
Bebop/bebopBrowserVideo-master/Broadway/Player/Decoder.js" as it exceeds
the max of "100KB".
[21:34:01] Browserify Error { [Error: Cannot find module 'utf-8-validate'
from 'C:\Users\Desktop\Robotics\Parrot
Bebop\bebopBrowserVideo-master\node_modules\ws\lib']
stream:
Labeled {
_readableState:
ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: [],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null,
resumeScheduled: false },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: true,
highWaterMark: 16,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false },
writable: true,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object] ],
length: 1,
label: 'deps' } }
[21:34:01] Browserify Error { [Error: Cannot find module 'bufferutil' from
'C:\Users\Desktop\Robotics\Parrot
Bebop\bebopBrowserVideo-master\node_modules\ws\lib']
stream:
Labeled {
_readableState:
ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: [],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null,
resumeScheduled: false },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: true,
highWaterMark: 16,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false },
writable: true,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object] ],
length: 1,
label: 'deps' } }

On Mon, Jan 11, 2016 at 6:53 PM, Johan Olsson [email protected]
wrote:

What bufferutil and utf8 can't be installed? Could you show me your
installation error?


Reply to this email directly or view it on GitHub
#14 (comment)
.

On Mon, Jan 11, 2016 at 6:53 PM, Johan Olsson [email protected]
wrote:

What bufferutil and utf8 can't be installed? Could you show me your
installation error?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

I assume you have tried npm install --save utf-8-validate bufferutil? there might be some stuff that just don't come with node in windows. Never actually used it

@adhamalkhaja
Copy link
Author

what do you use? mac? linux?

On Tue, Jan 12, 2016 at 9:47 PM, Johan Olsson [email protected]
wrote:

I assume you have tried npm install --save utf-8-validate bufferutil?
there might be some stuff that just don't come with node in windows. Never
actually used it


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

I use mac. But did you try to install the missing dependencies?

@adhamalkhaja
Copy link
Author

Yes I did , but it fails at node-gyp rebuild

On Tuesday, January 12, 2016, Johan Olsson [email protected] wrote:

I use mac. But did you try to install the missing dependencies?


Reply to this email directly or view it on GitHub
#14 (comment)
.

@johan-olsson
Copy link
Contributor

I really can't help you much with windows related issues. But the repository I linked you work so you should be able to google the more general errors you get

@leerlemoniii
Copy link

little late to this, but the node-gyp issues are likely because you are using a newer version of node.... I find that using nvm-windows on a windows box allows me to install and change node version (and npm) which then fixes most these node-gyp problems. Newer (v4 and 5) nodes have issues with nodegyp stuff that was compiled with the old 0. vaersions... When node and IO merged.

@deadprogram
Copy link
Member

Closing due to age of issue, and that the original point got a little lost. :)

Please open new issues as needed, thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants