Activity
Posted in Live Stream Video w/ Rails
live streaming would be an interesting feature for my latest mobile app https://surfcheck.xyz with the coming of 5G to many countries, it may be the future for many mobile apps.
I found many apis services offering live streaming, very easy to implement for incredible prices.
Some of this services are not available wordwide, for example Indonesia banned Vimeo and Tokbox.
This is the result of my research:
390$ per month for 5 hours
https://api.video/pricing
165$ per month for 2.000 GB Bandwith
https://www.dacast.com/live-streaming-pricing-plans/
0.004$ per participant per minute
https://www.twilio.com/video/pricing
Considering most of the apps do not become successfull, I may consider building the feature very quickly with twillio and react native, support it until it is not too expensive.
https://github.com/blackuy/react-native-twilio-video-webrtc
I could support up to 20 live streamings from 20 different locations, assisted from 4 users on average for 3 minutes length, just long enough so that users can check the weather/surf conditions.
Cost per minute 0.004$ * 20 video streams * 3 minutes length * 4 users = 0,96 $ per day.
30 $ per month on average with Twillio. You just need to make sure the user is streaming decent content and for a short period of time.
I did work on a video/live streaming project in the past, but I did not work on the RTMP data flow responsible for the live streaming.
Some of the tools I used were OpenSource, for example the vidibus/vidibus-recording gem should allow you to set up the rtmp streaming.
As described in the vidibus-recording gem, creating a live stream should as easy as running recording.start
, where recording
is an instance of your MyCustomRecording
class (but I believe it's much more complex then that..)
class MyCustomRecording
include Mongoid::Document
include Vidibus::Recording::Mongoid
end
but I don't think is no easy thing to set up, I don't even have an idea of what you have to use, HLS, RTMP or WebRTC.
https://stackoverflow.com/a/24032584/7295772
I believe the issue is not only setting up the video stream data flow between the live streaming mobile source and the server, but distributing the live streaming via cdn to make sure the video is accessible worldwide
seems twillio is the best option for me right now to deliver this feature quickly hopefully getting on the 5G wave in advance. I believe the introduction of new technologies will change the way Mobile devices are being used and create opportunities for new applications streaming on 5G.
The main question is now how much will it cost (time + servers cost) to migrate from Twillio to my own Ruby on Rails infrastructure for live streaming, as you can not scale an application at $0.01 x User / Minute.
on my way around the web I found also post, which uses a library rvideo
https://teapoci.blogspot.com/2008/04/video-streaming-in-ruby-on-rails.html
https://github.com/zencoder/rvideo
I'm asking the same question to André Pankratz owner of the vidibus open source project.
Everything is explained in this stackoverflow post https://stackoverflow.com/questions/49914376/javascript-objects-retrieve-child-class-variable
https://stackoverflow.com/questions/49914376/coffeescript-json-object-for-ajax-request
https://github.com/fabriziobertoglio1987/sprachspiel/blob/3ab451d16b1a7ea83f919158c7983bdae8c2e25b/app/assets/javascripts/products.coffee
in the end javascript is an essential skill for programmers so it does not make sense always do everything with ruby
In the last year I always avoided using javascript for the frontend logic, but this often makes me write bad code, not follow restful and Object Oriented design.