OpenTok and File Sharing - webrtc

I am building a video chat website using OpenTok. I have the video and text chat working, (still working on the screen sharing), but I was wondering if anyone could point me in the right direction regarding file sharing?
I would like both parties to be able to send files to each other, but not really sure how to go about it. Would it be possible to use Peer5?

There are several ways to get the peers to send files to each other.
A first way is to upload the file to your server or to some cloud storage service. Then share the link to the other peers via OpenTok's Signaling API (which is, presumably, an abstraction over WebRTC's DataChannels). This solution is simple, but not peer-to-peer.
Another solution is to, again, upload the file to a server and share the link to the other peers, but this time have the peers download the file via Peer5's Downloader. The Peer5 Downloader uses a coordination server to figure out which peers are available to help with the download. If no peers are available, the download will fall back to the HTTP server. This of course only makes sense if the file is being shared with several peers at the same time. In 1-to-1 communications it is pointless.
The previous solution is P2P only in the download part; the user still has to upload the file to a server. Another way, which would be P2P all the way, is to cut the file into chunks, and send them over the OpenTok Signaling API. It is a complicated process but there are several tutorials about this. The tutorials use the WebRTC DataChannel, but it is reasonable to assume that they could be adapted to the Signaling API:
https://bloggeek.me/send-file-webrtc-data-api/
http://www.html5rocks.com/en/tutorials/webrtc/datachannels/#build-a-file-sharing-application
A interesting open source application of a file sharing app using WebRTC is Sharefest, made by the guys from Peer5. You can use it for inspiration if you are inclined to make such a system.
As a side note, OpenTok seems to be considering to build a starter kit with sample code about how to integrate OpenTok with Peer5 in a file sharing application. I do not know how such an implementation will work, but I presume it is some variation of my second suggestion here. It could be good to keep an eye on it.

Related

using webrtc for audio broadcast

I'm trying to stream a microphone/audio to multiple clients.
the broadcaster is a screenless raspberry, so I can't open a Webbrowser and click on "share mircophone"
The clients will be using their smartphone to listen.
the latency must be super low.
I did not find any WebRTC Demo that worked. All of them are either p2p or the scalable Broadcasting from muaz khan is only working for the initiator; not clients.
I came across Janus (which I didn't really understand what exactly this is doing) but I don't get how to install this and how to configure it.
Is there any way to easily share the microphone's output via WebRTC? Something like Apache hosting a simple website where the microphone audio is hosted on?
Thanks for all the ideas on how to solve it!
Is there any way to easily share the microphone's output via WebRTC?
No. There's nothing easy or simple about WebRTC.
the broadcaster is a screenless raspberry, so I can't open a Webbrowser and click on "share mircophone"
This is the simplest option... running a browser. Are you sure you need to actually allow it to access the audio device?
In the past, I've used a flag on Chromium to get around this problem. I don't remember exactly what that flag was, but looking at the list, it might have been...
--use-fake-ui-for-media-stream
You might also be able to use --enable-kiosk-mode.
At a minimum, if you were to open the browser interactively and enable access, that page would get automatic access in the future.
I did not find any WebRTC Demo that worked. All of them are either p2p
WebRTC is peer-to-peer, but remember that the "server" can be one of those "peers".
Finally, you can look into using GStreamer, but don't expect anything quick and easy. https://github.com/centricular/gstwebrtc-demos

How to address Firebase from an Arduino?

Background: I've a sensor hooked up to an arduino printing readings through the serial monitor. I want to log these in firebase.
I've done a bit of digging on this, and my research has shown me that an arduino simply can't handle the SSL needed to talk to firebase properly.
Any suggestions for workarounds? Checking SO and google's only turned up "it can't be done", but I figured I'd ask anyway. Any lateral thinking is appreciated, thanks!
If you figure out a way, let us (support#firebase.com) know. That would be an awesome hack!
Some thoughts:
You might want to look into the Spark Core (available for pre-order). They mention SSL support, though it's unclear to me what that means exactly.
You could proxy the requests through a server that can speak SSL. For instance, you could run a tiny node.js service on an Amazon EC2 box that just proxies REST requests to Firebase (e.g. using http-proxy).
If you're hardcore, you could try to get the Arduino talking to an external ethernet controller that has built-in SSL support (e.g. this one), but that's probably a big project. :-)
Longer-term, we might expose a non-SSL endpoint for Firebase requests that's specifically for this sort of low-end hardware use-case. Ping us at support#firebase.com if you want to start a dialog.
Here's a php script I whipped together to solve for Arduino no https.
It's basically a form that GETs to the php script and then sends it off to your Firebase database.
http->php->Firebase
https://github.com/robertcedwards/httpFirebase
*Make sure you add Heroku or your server to the whitelist of IPs that can post to Firebase
I know its an old question but visitors from google keep coming.
Have a look at this post: http://www.devacron.com/arduino-firebase/
[EDITED]
These arduino libraries might help:
firebase-arduino
https://github.com/googlesamples/firebase-arduino
https://github.com/ed7coyne/firebase-arduino
To install it:
Download the zip file, go to Sketch>Manage Libraries>add .zip file
Now you have access to
#include <FirebaseArduino.h>
and can begin using it with
Firebase.begin("example.firebaseio.com", "token_or_secret");
Follow the example at https://github.com/ed7coyne/firebase-arduino/blob/master/examples/FirebaseDemo_ESP8266/FirebaseDemo_ESP8266.ino

Win 8 js code security

Im developing a win 8 game in js.
When i deploy my app, can any user can see my code files?
My files has some database passwords, i need to ofuscate it?
There's not really any good way to prevent people from mucking with your REST service if it's public. Sure, you can obfuscate things, digitally sign code, pass around certificates, etc. But in the end it's always possible for someone to reverse engineer your code, emulate a trusted client, or diagnose the network traffic directly.
A better solution here is to focus on mitigating unwanted attacks. Validate the input coming into each web service call, trust nothing, and do a threat analysis on your API. For example, if you were writing a Battleship game, have the server keep track of where each ship is and never expose that information to the clients, allowing them to write a fake client that could cheat. Do the scoring server side, so people can't just post fake scores and get on the high score list.
With that said, unless you're writing the next World of Warcraft, it's unlikely anyone cares enough about your game to jump through any hoops.
Everyone has access to every source file of your app. You just have to go to C:\Program Files\WindowsApps\ to see all your installed apps. If you have a HTML5 app installed, you'll notice that all the .html and .js files are freely accessible by anyone.
You may want to make a simple C# library that won't be so easy to reverse engineer, and put in it the "security critical" parts of your app. You can see how to integrate C# in HTML/JS apps in this MSDN page: http://msdn.microsoft.com/en-us/library/windows/apps/hh779077%28v=vs.110%29.aspx

Best FTP Objective-C wrapper for iPhone

I know you use the C based networking API to do FTP communication but I'd prefer to use something a little higher level. I've seen a few Objective-C based wrappers but I'm not sure what to use. I don't need that complex of FTP interaction. Its just the typical create/delete dirs, upload/download files... What do you recommend?
Edit:
Here is one that looks promising but I can't get it to compile for the iPhone SDK
The ConnectionKit
This may help, but you may reconsider design for reasons stated by bbum:
http://code.google.com/p/s7ftprequest/
The reason why you can't find much in the way of useful FTP client software is because FTP isn't used much any more and is generally actively discouraged from use.
Without great care, it is quite easy to create big old security holes when using FTP (when I ran a consulting company, the 3 times we had infected machines were all because of FTP server security holes or exploits -- one time, the damned HP copier's FTP server was the attack vector!).
FTP is also inefficient unless carefully configured.
I would encourage you to use an HTTP based protocol. WebDAV allows you to do basically anything FTP can do, but does so over an HTTP channel. Thus, it'll work through proxies and the like. Heck -- HTTP has become so ubiquitous that pretty much everything works with HTTP.
And, of course, there are plenty of good HTTP client APIs built for Objective-C.
Obviously, if FTP is a requirement for your project, this answer won't help you much....
After not finding anything that works well I decided I'd go ahead and follow Apple's tutorial on how to do FTP. It sure is a PITA but at least it does work. I'm defiantly going to support WebDAV in the first revision my app, and eventually perhaps some other transfer methods later on. I think I'm going to consider releasing this open source after I get FTP & WebDAV working good, since there is no reason why you should have to do this much low level work to do such a basic and ambiguous task as FTP these days.
I've implemented FTP file download and upload, directory create and directory list download through the regular FTP possibilities in the iPhone SDK. Note: you'd be passing the login name and password as part of every FTP request unsecured. Apparently no apparent connection to the FTP server is maintained at the app level, like with a real FTP client app, that I haven't been able to find for iPhone yet. If you're interested in the source code please let me know through e-mail.
GoldRaccoon isn't mentioned and can be found on GitHub. I use that library and it works very well (besides it didn't support FTP rename)

Newbie question on Flash video players, products/SDKs, and API

I'm a C programmer and a total newbie to Flash/video/web world. Don't know where/how to start, and so would greatly appreciate your initial help.
Question
If I need to host flash videos off of my website (instead of embedding YouTube links on my webpages),
AND
If I need to provide player API like YouTube's that can be used, say, for supporting chromeless player versions customizable via this custom API of mine...
THEN
What do I need to do essentially...?
Write a custom Flash video player?
If yes, how? I mean, using which Adobe products / tools / SDKs / language(s)?
Is there anything free/opensource available for doing this? Especially, for Linux platform?
Write a new browser (firefox) plugin for users visiting my site?
Not sure how my custom Flash video player will get to the user visiting my site for the first time?
Any books, resources that cover this problem well?
Does the Flash content need to hosted off of a Windows server only?
Currently lost. Thanks in advance,
/SD
Flash has video playback support built-in, so all you need to do is use the Flash authoring environment or Flex to compile a .SWF file that uses the video API, with some buttons to stop and start the stream, volume, seeking, anything else you want your player to do.
Many people have already done this for you, in a way you can easily use from simple HTML. See eg. OSFLV, Flowplayer, JW...
Write a new browser (firefox) plugin for users visiting my site? Does the Flash content need to hosted off of a Windows server only?
Lord no! Flash video would never have taken off if it was just another custom-server+custom-plugin piece of unpleasantness. Though special streaming servers are possible, for the most part it's just an FLV file sitting on a web server.
(FLV is the video format supported by the Flash video playing functions. There are many, many tools you can use to convert other formats to it; I use Avidemux.)
If you are planning to use a "Progressive Download" approach, then your FLV files can be hosted on a Windows or a Linux box. Be aware that:
it is no as efficient as true
streaming.
you may not use it for live events
nor only for stored video files.
it cannot automatically detect the
end user's connection speed.
it is not possible to jump ahead to
another part while it's downloaded.
the video file will be saved on the
end user's computer.
If you are planning to use a "Streaming" approach then you can either buy and use Adobe's solution (Flash Media Server, available on both Windows and Linux box) or sign up for a hosted solution. On this page you will find recommended providers by Adobe. I personally have been using Influxis's hosting with success for a couple of years already.
You can also write your own streaming server but that would be a lot of hard work. If you are interested in that, I would recommend you have a look a Red5 which is an open source Flash Server written in Java.