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

Real URLs #4

Merged
merged 3 commits into from
Jul 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions app/public/js/src/channel.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
$ ->
timer = null

videoPlayer = ->
$("#video-player")[0]

statusUrl = ->
$('#video-player').data('status-url')

tuneUrl = ->
$('#video-player').data('tune-url')

playUrl = ->
$('#video-player').data('play-url')

Expand All @@ -30,6 +34,19 @@ $ ->

$('.alert').hide() if not title? and not message?

tune = ->
console.log('tuning channel')
$.ajax tuneUrl(),
type: 'post'
dataType: 'json'
beforeSend: (jqXHR) ->
jqXHR.setRequestHeader("Accept", "application/json")
startLoading("Tuning channel...")
success: (data, textStatus, jqXHR) ->
timer = setInterval ->
checkStatus()
, 1000

play = ->
deviceAgent = navigator.userAgent.toLowerCase()
agentID = deviceAgent.match(/(iphone|ipod|ipad)/)
Expand All @@ -55,10 +72,11 @@ $ ->
clearInterval(timer)
stopLoading('Stream is ready!', 'The stream is ready to play.')
play()
error: (jqXHR, textStatus, errorThrown) ->
console.log(textStatus)
console.log(errorThrown)
tune()


if videoPlayer()?
checkStatus()
timer = setInterval ->
checkStatus()
, 1000
14 changes: 0 additions & 14 deletions app/public/js/src/channels.coffee

This file was deleted.

4 changes: 1 addition & 3 deletions app/views/channel.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
<div class="alert alert-block alert-info hide">
<h4></h4>
</div>
<video controls id="video-player" class="hide" src="/channels/<%= @channel %>.m3u8" width="640" height="360" data-play-url="/channels/<%= @channel %>.m3u8" data-status-url="/channels/<%= @channel %>/status"></video>
<video controls id="video-player" class="hide" src="/channels/<%= @channel %>.m3u8" width="640" height="360" data-tune-url="/channels/<%= @channel %>/tune" data-play-url="/channels/<%= @channel %>.m3u8" data-status-url="/channels/<%= @channel %>/status"></video>
</center>


2 changes: 1 addition & 1 deletion app/views/channels.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<% @channels.each do |channel| %>
<tr>
<td>
<a class="channel" href="#" data-channel="<%= channel['GuideNumber'] %>">
<a class="channel" href="/channels/<%= channel['GuideNumber']%>" data-channel="<%= channel['GuideNumber'] %>">
<%= "#{channel['GuideNumber']} - #{channel['GuideName']}" %>
</a>
<a href="#" class="favorite <%= 'starred' if Wallop.favorite_channels.include?(channel['GuideNumber'])%>" data-channel="<%= channel['GuideNumber'] %>"><i class="<%= Wallop.favorite_channels.include?(channel['GuideNumber']) ? 'icon-star' : 'icon-star-empty' %> icon-large pull-right"></i></a>
Expand Down
1 change: 0 additions & 1 deletion app/views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<script src="/js/bootstrap.min.js"></script>

<script type="text/coffeescript" src="/js/src/channel.coffee"></script>
<script type="text/coffeescript" src="/js/src/channels.coffee"></script>
<script type="text/coffeescript" src="/js/src/favorites.coffee"></script>
<script src="/js/coffee-script.js"> </script>

Expand Down