playback bugz
This commit is contained in:
BIN
tv/favicon.ico
Normal file
BIN
tv/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -19,10 +19,9 @@ var audio = (function(){
|
|||||||
context.decodeAudioData(request.response, function(buf) {
|
context.decodeAudioData(request.response, function(buf) {
|
||||||
bufs[site.domain] = buf
|
bufs[site.domain] = buf
|
||||||
loader.ready(site.domain + "_sound")
|
loader.ready(site.domain + "_sound")
|
||||||
}, function () { console.error('The request failed.') } )
|
}, function () {
|
||||||
}
|
ytmnd.error()
|
||||||
request.onerror = function() {
|
})
|
||||||
ytmnd.error()
|
|
||||||
}
|
}
|
||||||
request.send()
|
request.send()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ var ytmnd = (function(){
|
|||||||
var sites = []
|
var sites = []
|
||||||
var loaded = {}
|
var loaded = {}
|
||||||
var index = 0
|
var index = 0
|
||||||
var play_immediately = true
|
var loading = false
|
||||||
|
var next_domain = ""
|
||||||
|
|
||||||
var base_href = 'https://ltho.s3.amazonaws.com/ytmnd'
|
var base_href = 'https://ltho.s3.amazonaws.com/ytmnd'
|
||||||
|
|
||||||
@@ -25,9 +26,27 @@ var ytmnd = (function(){
|
|||||||
|
|
||||||
ytmnd.ready = function(){
|
ytmnd.ready = function(){
|
||||||
shuffle(sites)
|
shuffle(sites)
|
||||||
|
ytmnd.bind()
|
||||||
ytmnd.play_index(index)
|
ytmnd.play_index(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ytmnd.bind = function(){
|
||||||
|
window.addEventListener("keydown", function(e){
|
||||||
|
console.log(e.keyCode)
|
||||||
|
switch (e.keyCode){
|
||||||
|
case 37: // left
|
||||||
|
case 38: // up
|
||||||
|
ytmnd.prev()
|
||||||
|
break
|
||||||
|
case 32: // space
|
||||||
|
case 39: // right
|
||||||
|
case 40: // down
|
||||||
|
ytmnd.next()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
ytmnd.preload = function(site){
|
ytmnd.preload = function(site){
|
||||||
site.image_url = base_href + "/" + site.username + "/" + site.domain + "." + site.image_type
|
site.image_url = base_href + "/" + site.username + "/" + site.domain + "." + site.image_type
|
||||||
site.sound_url = base_href + "/" + site.username + "/" + site.domain + "." + site.sound_type
|
site.sound_url = base_href + "/" + site.username + "/" + site.domain + "." + site.sound_type
|
||||||
@@ -36,6 +55,8 @@ var ytmnd = (function(){
|
|||||||
loaded[site.domain] = site
|
loaded[site.domain] = site
|
||||||
if (next_domain == site.domain) {
|
if (next_domain == site.domain) {
|
||||||
ytmnd.play(site)
|
ytmnd.play(site)
|
||||||
|
next_domain = ""
|
||||||
|
loading = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
loader.register('init')
|
loader.register('init')
|
||||||
@@ -57,12 +78,13 @@ var ytmnd = (function(){
|
|||||||
else {
|
else {
|
||||||
next_domain = site.domain
|
next_domain = site.domain
|
||||||
ytmnd.preload(site)
|
ytmnd.preload(site)
|
||||||
|
loading = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ytmnd.play = function(site){
|
ytmnd.play = function(site){
|
||||||
document.querySelector("title").innerHTML = site.title
|
document.querySelector("title").innerHTML = site.title
|
||||||
document.body.style.backgroundColor = site.bgcolor
|
document.body.style.backgroundColor = "#" + site.bgcolor
|
||||||
document.body.style.backgroundImage = "url(" + site.image_url + ")"
|
document.body.style.backgroundImage = "url(" + site.image_url + ")"
|
||||||
document.body.className = site.placement
|
document.body.className = site.placement
|
||||||
audio.play(site.domain)
|
audio.play(site.domain)
|
||||||
@@ -76,7 +98,7 @@ var ytmnd = (function(){
|
|||||||
zoomtext.empty()
|
zoomtext.empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
ytmnd.back = function(){
|
ytmnd.prev = function(){
|
||||||
ytmnd.stop()
|
ytmnd.stop()
|
||||||
index = (index-1) % sites.length
|
index = (index-1) % sites.length
|
||||||
ytmnd.play_index(index)
|
ytmnd.play_index(index)
|
||||||
@@ -94,6 +116,10 @@ var ytmnd = (function(){
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ytmnd.error = function(){
|
||||||
|
ytmnd.next()
|
||||||
|
}
|
||||||
|
|
||||||
return ytmnd
|
return ytmnd
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ var zoomtext = (function(){
|
|||||||
return zoomtext.empty()
|
return zoomtext.empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = ytmnd_info['site']['zoom_text']
|
var text = site['zoom_text']
|
||||||
|
|
||||||
var offset = 100, rows = ""
|
var offset = 100, rows = ""
|
||||||
if ("line_3" in zoom_text && zoom_text["line_3"].length > 0) {
|
if ("line_3" in zoom_text && text["line_3"].length > 0) {
|
||||||
rows += zoomtext.add_row( zoom_text['line_3'], offset, 500 )
|
rows += zoomtext.add_row( text['line_3'], offset, 500 )
|
||||||
offset += 50
|
offset += 50
|
||||||
}
|
}
|
||||||
if ("line_2" in zoom_text && zoom_text["line_2"].length > 0) {
|
if ("line_2" in zoom_text && text["line_2"].length > 0) {
|
||||||
rows += zoomtext.add_row( zoom_text['line_2'], offset, 250 )
|
rows += zoomtext.add_row( text['line_2'], offset, 250 )
|
||||||
offset += 50
|
offset += 50
|
||||||
}
|
}
|
||||||
if ("line_1" in zoom_text && zoom_text["line_1"].length > 0) {
|
if ("line_1" in zoom_text && text["line_1"].length > 0) {
|
||||||
rows += zoomtext.add_row( zoom_text['line_1'], offset, 500 )
|
rows += zoomtext.add_row( text['line_1'], offset, 500 )
|
||||||
}
|
}
|
||||||
|
|
||||||
el.innerHTML = rows.join("")
|
el.innerHTML = rows.join("")
|
||||||
|
|||||||
Reference in New Issue
Block a user