I would like to create a HLS playlist that I can upload to S3 and serve adaptive bitrate video to visitors. To achieve this, I want to create an Oban worker which takes the URL of a .ts
file as input, and outputs a URL of a .m3u8
playlist. The playlist would then get embedded into Heex in my Phoenix app.
I found another post with some code from 2-3 years ago which does what I want, but the dependent Membrane framework library membrane_mpegts_plugin
hasn’t been updated in 4 years and isn’t compatible with membrane_core 1.1.2.
I really need to work with .ts
files so I figured I’d update membrane_mpegts_plugin
. Thankfully, membrane_core has a good changelog and upgrade guides which outline what needs to change in the plugin. I’ve spent two days on the task and I’ve made lots of progress, but I’ve ran into a testing error that I’m having trouble understanding and working through.
1) test Demuxer works in a Pipeline that defines links statically in its init (Membrane.MPEG.TS.IntegrationTest)
test/mpeg_ts/integration_test.exs:13
Assertion failed, no matching message after 2000ms
Showing 2 of 2 messages in the mailbox
code: assert_receive {Membrane.Testing.Pipeline, ^pid_value, {:handle_element_start_of_stream, {:audio_out, :input}}}
mailbox:
pattern: {
Membrane.Testing.Pipeline,
^pid_value,
{
:handle_element_start_of_stream,
{:audio_out, :input}
}
}
value: {Membrane.Testing.Pipeline, #PID<0.278.0>, :setup}
pattern: {
Membrane.Testing.Pipeline,
^pid_value,
{
:handle_element_start_of_stream,
{:audio_out, :input}
}
}
value: {Membrane.Testing.Pipeline, #PID<0.278.0>, :play}
stacktrace:
test/mpeg_ts/integration_test.exs:34: Membrane.MPEG.TS.IntegrationTest.perform_integration_test/1
test/mpeg_ts/integration_test.exs:14: (test)
I’m struggling to understand why the shape of the pattern { Membrane.Testing.Pipeline, ^pid_value, { :handle_element_start_of_stream, {:audio_out, :input} } }
is so different from the value {Membrane.Testing.Pipeline, #PID<0.278.0>, :play}
. How come the pattern has a tuple after ^pid_value,
, whereas the value has a :play
atom after the PID? Normally this is where I would look at the code in the stack trace, but in this case there isn’t any file beyond integration_test.exs which I’m already familiar with.
I tried configuring ExUnit to show more stacktrace by setting :stacktrace_depth to 50, but that didn’t give me any more lines than the 2 I already see.
I’m hoping for some outside perspective to help get me back on track.