Phoenix Live Components for Elixir WebRTC.
In your mix.exs:
def deps do
[
{:live_ex_webrtc, "~> 0.8.0"}
]
endIn your tailwind.config.js
module.exports = {
content: [
"../deps/live_ex_webrtc/**/*.*ex" // ADD THIS LINE
]
}LiveExWebRTC comes with two Phoenix.LiveViews:
LiveExWebRTC.Publisher- sends audio and video via WebRTC from a web browser to a Phoenix app (browser publishes)LiveExWebRTC.Player- sends audio and video via WebRTC from a Phoenix app to a web browser and plays it in the HTMLVideoElement (browser subscribes)
See module docs and live_broadcaster for more.
For local development:
-
include
live_ex_webrtcin yourmix.exsviapath -
modify
NODE_PATHenv variable in your esbuild configuration, which is located inconfig.exs- this will allow for importing javascript hooks fromlive_ex_webrtc.For example:
config :esbuild, # ... default: [ # ... env: %{ "NODE_PATH" => "#{Path.expand("../deps", __DIR__)}:/path/to/parent/dir/of/live_ex_webrtc" } ]
-
modify
contentintailwind.config.js- this will compile tailwind classes used in live components.For example:
module.exports = { content: [ // ... "../deps/**/*.ex" ] }
Separate paths with
:on MacOS/Linux and with;on Windows.
Specify path to live_ex_webrtc's parent directory.