David Kimura PRO
Joined 7/18/2015
Drifting Ruby Owner
David Kimura PRO said almost 6 years ago on Tracking Changes on Action Text :
  You can do that with something existing like paper_trail. Or for other attributes, you could role your own solution as a concern; similar to what we did in this episode. https://www.driftingruby.com/episodes/auditing-with-paper-trail


David Kimura PRO said almost 6 years ago on Adaptive Bitrate Streaming with Active Storage :
  
- I'm wondering whether you could provide a few more resources about what you researched in order to figure out how to work with FFMPEG and HLS. For example, how often and where might you look to keep tabs on new developments/make updates so that you keep up with high quality video serving?

Honestly, I forget the resources that I came across while researching this episode. It was several weeks of research to get to this final product. However, the github pages for the videojs and https://github.com/videojs/http-streaming are good resources



- What are the tradeoffs that you've found to using mp4 over webm ? Since we have already broken out ffmpeg, should we add a step to transcode  to webm instead of mp4?

The web now-a-days works pretty good using MP4. So far, I've not seen any issues on the browsers and devices that i've tested on.

- I'm curious why did you choose to go with a bash script over writing an FFMPEG wrapper in ruby (or using an existing gem, like streamio-ffmpeg)?

I didn't want to add an additional dependency to my application. The bash script is complicated, but easy enough to debug locally.

- When you deploy this to production -- how do you monitor resource usage/failures?

I run the conversion in a background job. The background job handles retrying as well as notifications. As far as resources go, and since these are happening in a background job, I would rely on the infrastructure to handle notifications of peaks and autoscaling.

- How might you write tests for an the `ConvertHls` class?

I would probably include a tiny video file within my repo and use that as my test case. As edge cases arise, perhaps with other formats, those could be added as well. I would try to keep each video file <= 1MB (or have them externally available).

- How might you debug the bash script if you deploy to prod?

So far, I've not had to worry about this. Everything has been working fairly well. It is actually what I'm using on Drifting Ruby right now. However, if I did have to debug a production issue, I would probably pull down the video file in question and test it locally. 

David Kimura PRO said almost 6 years ago on Video Chat with WebRTC :
  Here's how I created the coturn server. Using an Ubuntu 18.04LTS virtual machine.

apt-get update && apt-get install -y coturn && apt-get clean

Edit the environment file to set some environment variables. Be sure to change as necessary.

# vi /etc/environment
TURN_PORT=3478
TURN_PORT_START=10000
TURN_PORT_END=20000
TURN_SECRET=yoursecretkey
TURN_SERVER_NAME=turn
TURN_REALM=YOURDOMAINNAME

Run source to set the variables

source /etc/environment

Edit the coturn file

sudo vi /etc/default/coturn

And change the value to 1

TURNSERVER_ENABLED=1

Generate an encrypted password. Be sure to use the same TURN_REALM name as set in the /etc/environment

turnadmin -k -u USERNAME -r YOURDOMAINNAME -p PASSWORD

Edit the turnserver configuration file

sudo vi /etc/turnserver.conf

Add the user into the configuration file. The encrypted password would be something like 0x0000000

user=USERNAME:PASSWORD

Restart coturn

sudo service coturn restart

Also, depending on where this is being hosted. You will need to open the UDP ports on your firewall based on the configuration set in /etc/environment. So, the password that you set will be encrypted on the server, but will need to be entered as plain text within the javascript stimulus controller.

David Kimura PRO said almost 6 years ago on Dynamic Role Management :
You don't get the benefit of having attributes limited on a per user basis with Pundit or Cancancan. This would pair nicely with either of those.

David Kimura PRO said almost 6 years ago on Adaptive Bitrate Streaming with Active Storage :
  In this example, it is persisting the data into memory for the life of the request. If there are a bunch of concurrent streams, then this could be problematic. However, on the 2GB RAM servers that I'm running Drifting Ruby on, I haven't seen it become a real issue yet.