forked from avalonmediasystem/avalon
/
_item_view.html.erb
94 lines (83 loc) · 4.21 KB
/
_item_view.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<%#
Copyright 2011-2014, The Trustees of Indiana University and Northwestern
University. Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
--- END LICENSE_HEADER BLOCK ---
%>
<div class="row">
<div class="span8" id="left_column">
<section id="player" style="width: 100%">
<% if @currentStream.present? and @currentStream.succeeded? %>
<%= stylesheet_link_tag "mediaelement_rails/mediaelementplayer" =%>
<% if @currentStreamInfo[:is_video] %>
<%= master_file_meta_properties(@currentStream) do %>
<video class="mejs-avalon" controls width="450" height="309" style="width: 100%; height: 100%" id="video-tag" poster="<%= @currentStreamInfo[:poster_image] %>" preload="auto">
<% @currentStreamInfo[:stream_flash].each do |flash| %>
<source src="<%= flash[:url] %>" data-quality="<%= flash[:quality] %>" data-plugin-type="flash" type="video/rtmp"/>
<% end %>
<% @currentStreamInfo[:stream_hls].each do |hls| %>
<source src="<%= hls[:url] %>" data-quality="<%= hls[:quality] %>" data-plugin-type="native" type="application/vnd.apple.mpegURL"/>
<% end %>
</video>
<% end %>
<% else %>
<%= master_file_meta_properties(@currentStream) do %>
<audio class="mejs-avalon" controls style="width: 100%;" id="video-tag" preload="true">
<% @currentStreamInfo[:stream_flash].each do |flash| %>
<source src="<%= flash[:url] %>" data-quality="<%= flash[:quality] %>" data-plugin-type="flash" type="audio/rtmp"/>
<% end %>
<% @currentStreamInfo[:stream_hls].each do |hls| %>
<source src="<%= hls[:url] %>" data-quality="<%= hls[:quality] %>" data-plugin-type="native" type="application/vnd.apple.mpegURL"/>
<% end %>
</audio>
<% end %>
<% end %>
<% end %>
</section>
<%= render 'video_player' %>
<%= render partial: 'sections',
locals: {mediaobject: @mediaobject,
sections: @masterFiles,
activeStream: @currentStream} %>
<%= render('share') if can?(:share, MediaObject) %>
</div>
<div class="span4" id="right-column">
<div id="metadata_container" class="">
<section id="metadata"><%= render "metadata_display" %></section>
</div>
</div>
</div>
<% content_for :page_scripts do %>
<%= javascript_include_tag "mediaelement_rails/mediaelement-and-player" =%>
<%= javascript_include_tag 'switch_streams' %>
<%= javascript_include_tag 'mediaelement-qualityselector/mep-feature-qualities' %>
<%= javascript_include_tag 'me-thumb-selector' %>
<%= javascript_include_tag 'mediaelement-skin-avalon/mep-feature-responsive' %>
<%= stylesheet_link_tag "mediaelement-qualityselector/mep-feature-qualities" =%>
<%= stylesheet_link_tag 'me-thumb-selector' %>
<%= stylesheet_link_tag "mediaelement-skin-avalon/mejs-skin-avalon" =%>
<%
features = ['playpause','current','progress','duration','volume','qualities']
features << 'thumbnailSelector' if can? :edit, @mediaobject
features.concat ['fullscreen','responsive']
%>
<script>
currentPlayer = new MediaElementPlayer('#video-tag',
{ mode: 'auto_plugin',
pluginPath: <%= asset_path('mediaelement_rails/').inspect.html_safe %>,
usePluginFullScreen: false,
thumbnailSelectorUpdateURL: '/update-url',
thumbnailSelectorEnabled: true,
features: <%=features.inspect.html_safe%>,
audioHeight: <%= MasterFile::AUDIO_HEIGHT %>,
mobileDisplayedDuration: <%= @currentStream ? (@currentStream.duration.to_f / 1000).round : -1 %>,
startQuality: 'low'
});
</script>
<% end %>