Skip to content

Commit 57fa0a8

Browse files
committed
Pass version layout filepath to wowza
1 parent 9319fe0 commit 57fa0a8

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

app/models/stacks_file.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ def cantaloupe_identifier
4949
CGI.escape(storage_root.relative_path)
5050
end
5151

52+
def wowza_identifier
53+
file_path = storage_root.relative_path
54+
streaming_url_file_segment = case File.extname(file_name)
55+
when '.mp3'
56+
"mp3:#{File.basename(file_path)}"
57+
else
58+
"mp4:#{File.basename(file_path)}"
59+
end
60+
61+
"#{File.dirname(file_path)}/#{streaming_url_file_segment}"
62+
end
63+
5264
def storage_root
5365
@storage_root ||= StorageRoot.new(cocina:, file_name:)
5466
end

app/models/stacks_media_stream.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ def initialize(stacks_file:)
1515
:embargo_release_date, :location, :world_viewable?, :no_download?, to: :stacks_rights
1616

1717
def streaming_url
18-
file_path = "#{stacks_file.storage_root.treeified_id.delete_prefix('/')}/#{streaming_url_file_segment}"
19-
WowzaSecureToken.new(file_path:).streaming_url
20-
end
21-
22-
private
23-
24-
def streaming_url_file_segment
25-
case File.extname(file_name)
26-
when '.mp3'
27-
"mp3:#{file_name}"
28-
else
29-
"mp4:#{file_name}"
30-
end
18+
WowzaSecureToken.new(file_path: stacks_file.wowza_identifier).streaming_url
3119
end
3220
end

spec/requests/iiif/auth/v2/probe_service_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
"status" => 302
215215
})
216216
location = response.parsed_body.dig('location', 'id')
217-
expect(location).to start_with 'https://sul-mediaserver.stanford.edu/stacks/_definst_/bb/000/cr/7262/mp4:SC0193_1982-013_b06_f01_1981-09-29.mp4/playlist.m3u8?wowzatokenendtime='
217+
expect(location).to start_with 'https://sul-mediaserver.stanford.edu/stacks/_definst_/bb/000/cr/7262/bb000cr7262/content/mp4:8ff299eda08d7c506273840d52a03bf3/playlist.m3u8?wowzatokenendtime='
218218
expect(location).to end_with('=') # Token is md5 encoded
219219
end
220220
end

0 commit comments

Comments
 (0)