trying to fix adudio player bug, added audio play piwik tracking
This commit is contained in:
@@ -555,7 +555,8 @@
|
|||||||
.emmit('stop-shuffle')
|
.emmit('stop-shuffle')
|
||||||
.openDocument({
|
.openDocument({
|
||||||
nid:$link.attr('nid'),
|
nid:$link.attr('nid'),
|
||||||
audio_url:$link.attr('audio_url')
|
audio_url:$link.attr('audio_url'),
|
||||||
|
title:$link.find('.field--name-title').html()
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -759,6 +760,22 @@
|
|||||||
|
|
||||||
this.emmit('audio-open-document', {caller:caller});
|
this.emmit('audio-open-document', {caller:caller});
|
||||||
|
|
||||||
|
|
||||||
|
// piwik
|
||||||
|
debugger;
|
||||||
|
if(typeof _paq !== 'undefined'){
|
||||||
|
// page tracking
|
||||||
|
// https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/
|
||||||
|
// _paq.push(['setCustomUrl', state.url]);
|
||||||
|
// _paq.push(['setDocumentTitle', data.title]);
|
||||||
|
// _paq.push(['trackPageView']);
|
||||||
|
// js event
|
||||||
|
// trackEvent(category, action, [name], [value])
|
||||||
|
if(typeof node.title != 'undefined'){
|
||||||
|
_paq.push(['trackEvent', 'Audio', 'play', node.title]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.launch();
|
this.launch();
|
||||||
},
|
},
|
||||||
launch(){
|
launch(){
|
||||||
@@ -792,15 +809,18 @@
|
|||||||
this.updateLoadingBar();
|
this.updateLoadingBar();
|
||||||
},
|
},
|
||||||
updateLoadingBar(){
|
updateLoadingBar(){
|
||||||
this.$loader.css({
|
// if (track.readyState === 4){
|
||||||
'width':parseInt((100 * this.audio.buffered.end(0) / this.audio.duration), 10)+'%'
|
if(track.buffered.length>0){
|
||||||
});
|
this.$loader.css({
|
||||||
if( this.audio.buffered.end(0) < this.audio.duration ){
|
'width':parseInt((100 * this.audio.buffered.end(0) / this.audio.duration), 10)+'%'
|
||||||
// loop through this function until file is fully loaded
|
});
|
||||||
var that = this;
|
if( this.audio.buffered.end(0) < this.audio.duration ){
|
||||||
window.requestAnimationFrame(that.updateLoadingBar.bind(that));
|
// loop through this function until file is fully loaded
|
||||||
}else{
|
var that = this;
|
||||||
//console.log('Audio fully loaded');
|
window.requestAnimationFrame(that.updateLoadingBar.bind(that));
|
||||||
|
}else{
|
||||||
|
//console.log('Audio fully loaded');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCanplay(){
|
onCanplay(){
|
||||||
|
|||||||
@@ -555,7 +555,8 @@
|
|||||||
.emmit('stop-shuffle')
|
.emmit('stop-shuffle')
|
||||||
.openDocument({
|
.openDocument({
|
||||||
nid:$link.attr('nid'),
|
nid:$link.attr('nid'),
|
||||||
audio_url:$link.attr('audio_url')
|
audio_url:$link.attr('audio_url'),
|
||||||
|
title:$link.find('.field--name-title').html()
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -759,6 +760,22 @@
|
|||||||
|
|
||||||
this.emmit('audio-open-document', {caller:caller});
|
this.emmit('audio-open-document', {caller:caller});
|
||||||
|
|
||||||
|
|
||||||
|
// piwik
|
||||||
|
debugger;
|
||||||
|
if(typeof _paq !== 'undefined'){
|
||||||
|
// page tracking
|
||||||
|
// https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/
|
||||||
|
// _paq.push(['setCustomUrl', state.url]);
|
||||||
|
// _paq.push(['setDocumentTitle', data.title]);
|
||||||
|
// _paq.push(['trackPageView']);
|
||||||
|
// js event
|
||||||
|
// trackEvent(category, action, [name], [value])
|
||||||
|
if(typeof node.title != 'undefined'){
|
||||||
|
_paq.push(['trackEvent', 'Audio', 'play', node.title]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.launch();
|
this.launch();
|
||||||
},
|
},
|
||||||
launch(){
|
launch(){
|
||||||
@@ -792,15 +809,18 @@
|
|||||||
this.updateLoadingBar();
|
this.updateLoadingBar();
|
||||||
},
|
},
|
||||||
updateLoadingBar(){
|
updateLoadingBar(){
|
||||||
this.$loader.css({
|
// if (track.readyState === 4){
|
||||||
'width':parseInt((100 * this.audio.buffered.end(0) / this.audio.duration), 10)+'%'
|
if(track.buffered.length>0){
|
||||||
});
|
this.$loader.css({
|
||||||
if( this.audio.buffered.end(0) < this.audio.duration ){
|
'width':parseInt((100 * this.audio.buffered.end(0) / this.audio.duration), 10)+'%'
|
||||||
// loop through this function until file is fully loaded
|
});
|
||||||
var that = this;
|
if( this.audio.buffered.end(0) < this.audio.duration ){
|
||||||
window.requestAnimationFrame(that.updateLoadingBar.bind(that));
|
// loop through this function until file is fully loaded
|
||||||
}else{
|
var that = this;
|
||||||
//console.log('Audio fully loaded');
|
window.requestAnimationFrame(that.updateLoadingBar.bind(that));
|
||||||
|
}else{
|
||||||
|
//console.log('Audio fully loaded');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCanplay(){
|
onCanplay(){
|
||||||
|
|||||||
Reference in New Issue
Block a user