hybridgroup / node-bebop

A Node.js client for controlling Parrot Bebop & Bebop2 quadcopters.
http://nodebebop.com
MIT License
146 stars 61 forks source link

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

Closed adhamalkhaja closed 7 years ago

adhamalkhaja commented 8 years ago

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 commented 8 years ago

I think you will find this issue helpful #9

adhamalkhaja commented 8 years ago

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 notifications@github.com wrote:

I think you will find this issue helpful #9 https://github.com/hybridgroup/node-bebop/issues/9

— Reply to this email directly or view it on GitHub https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-167125999 .

johan-olsson commented 8 years ago

@uaedronemaster Think your image failed to upload or something.

adhamalkhaja commented 8 years ago

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 notifications@github.com wrote:

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

— Reply to this email directly or view it on GitHub https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168216734 .

johan-olsson commented 8 years ago

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 commented 8 years ago

well do u see it now?

On Thu, Dec 31, 2015 at 8:57 PM, Adham Al-Khaja admalkhaja@gmail.com wrote:

On Thu, Dec 31, 2015 at 8:47 PM, Adham Al-Khaja admalkhaja@gmail.com 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 notifications@github.com wrote:

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

— Reply to this email directly or view it on GitHub https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168216734 .

johan-olsson commented 8 years ago

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

adhamalkhaja commented 8 years ago

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168226395 .

adhamalkhaja commented 8 years ago

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 admalkhaja@gmail.com wrote:

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168226395 .

johan-olsson commented 8 years ago

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

adhamalkhaja commented 8 years ago

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

On Thu, Dec 31, 2015 at 9:42 PM, Adham Al-Khaja admalkhaja@gmail.com 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 admalkhaja@gmail.com wrote:

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168226395 .

adhamalkhaja commented 8 years ago

I posted the new error picture

On Thu, Dec 31, 2015 at 9:44 PM, Adham Al-Khaja admalkhaja@gmail.com wrote:

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

On Thu, Dec 31, 2015 at 9:42 PM, Adham Al-Khaja admalkhaja@gmail.com 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 admalkhaja@gmail.com wrote:

yes it is installed globally

On Thu, Dec 31, 2015 at 9:36 PM, Johan Olsson notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168226395 .

johan-olsson commented 8 years ago

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

adhamalkhaja commented 8 years ago

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 notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168310637 .

johan-olsson commented 8 years ago

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 commented 8 years ago

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 notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168522067 .

adhamalkhaja commented 8 years ago

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 admalkhaja@gmail.com 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 notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-168310637 .

deadprogram commented 8 years ago

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

johan-olsson commented 8 years ago

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 commented 8 years ago

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

adhamalkhaja commented 8 years ago

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 admalkhaja@gmail.com 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 notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-169805923 .

johan-olsson commented 8 years ago

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

adhamalkhaja commented 8 years ago

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 notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-170577911 .

On Mon, Jan 11, 2016 at 6:53 PM, Johan Olsson notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-170577911 .

johan-olsson commented 8 years ago

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 commented 8 years ago

what do you use? mac? linux?

On Tue, Jan 12, 2016 at 9:47 PM, Johan Olsson notifications@github.com 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 https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-170989423 .

johan-olsson commented 8 years ago

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

adhamalkhaja commented 8 years ago

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

On Tuesday, January 12, 2016, Johan Olsson notifications@github.com wrote:

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

— Reply to this email directly or view it on GitHub https://github.com/hybridgroup/node-bebop/issues/14#issuecomment-171016050 .

johan-olsson commented 8 years ago

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 commented 8 years ago

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 commented 7 years ago

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

Please open new issues as needed, thanks everyone!