Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Audio to use HLS #2512

Merged
merged 2 commits into from
Feb 1, 2019
Merged

Change Audio to use HLS #2512

merged 2 commits into from
Feb 1, 2019

Conversation

tpendragon
Copy link
Contributor

  • Generates HLS instead of MP3s
  • Speeds up clicking around viewer significantly.
  • Regenerating derivatives will delete old MP3 derivatives.
  • Passes auth tokens through the HLS manifest.

Closes #2149

* Generates HLS instead of MP3s
* Speeds up clicking around viewer significantly.
* Regenerating derivatives will delete old MP3 derivatives.
* Passes auth tokens through the HLS manifest.
@@ -13,6 +13,7 @@ def show
end

def send_content
return send_hls if file_desc.mime_type.first.to_s == "application/x-mpegURL" && params[:auth_token].present?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're only serving HLS if there's an auth token? Are we not using it for the viewer when the user is logged into Figgy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're only re-formatting the HLS if there's an auth token. Otherwise it just falls through to nginx and sends the file that's on disk, unmodified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 OK, that makes sense — send_hls below is rewriting the existing HLS file with auth_token links.

change_set_persister.buffer_into_index do |buffered_persister|
buffered_persister.save(change_set: change_set)
end
end

def generate_hls_derivatives(dir)
_stdout, _stderr, status =
Open3.capture3("ffmpeg", "-y", "-i", file_object.disk_path.to_s, "-hls_list_size", "0", "-hls_time", "10", "-f", "hls", "-codec:a", "libmp3lame", dir.join("hls.m3u8").to_s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to move any of these settings to the config file like we do for kakadu?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that would improve readability, personally. Seems easier to have the command here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that, and I don't remember the thinking behind putting the jp2 recipes in the config file instead of in code like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just because that's how Hydra::Derivatives did it.

@@ -42,6 +42,10 @@ def derivative?
use.include?(Valkyrie::Vocab::PCDMUse.ServiceFile)
end

def derivative_partial?
use.include?(Valkyrie::Vocab::PCDMUse.ServiceFilePartial)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And definitely not in the http://pcdm.org/use ontology.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's totally made up, because nothing else fit. Works because that vocab's not a strict one.

@tpendragon tpendragon merged commit ea4dd0a into master Feb 1, 2019
@tpendragon tpendragon deleted the hlv_support branch February 1, 2019 00:44
@tpendragon tpendragon removed the Review label Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants