smolcatgirl
How would I serve / stream a video file?
Hi,
I want to serve or stream video files in the phoenix web ui of my software. I store video filenames and file sources in my database. The source table have columns called id and location. When a user visits /video/1/test.mkv the video file called test.mkv from the source with the id of 1 should start playing. Not all video files live in the same source and the sources could be anywhere on filesystem, but not inside the the priv/static directory. Those videos files can be placed in this sources at any time after deployment and if a requested file exists in the given source it should be played in the browser. Otherwise 404 error should be sent along with a error message.
What do you think? What would be the best way to do this? Please ask if something is unclear!
Thanks for your time!
Most Liked
Phillipp
I have the suspicion that you all get the question wrong.
If I understand @smolcatgirl correctly, she wants true video streaming.
What send_file or Plug.Static do is to send the whole video file to the browser.
So she wants partial video streaming. Like buffering x amount of seconds ahead of current playtime or if the user starts the video from the middle, don’t even load the first half.
I can’t give an answer for how to do this but I hope someone else might have an idea.
lud
Well this article is outdated but have very useful information: https://medium.com/@miguel.coba/streaming-video-with-phoenix-31cd6c3048e . Not hard to make it work with the lastest version of Phoenix.
But the problem when you want to stream videos is to allow different qualities/bitrate depending on bandwidth and/or device screen-size/performance.
Last Post!
smolcatgirl
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









