mark episode as played if 20% is listened

pull/52/head
Akhil Gupta 4 years ago
parent e0b2b68c2a
commit 8b9ac4c568

@ -961,6 +961,9 @@ div#large-visualization{
let secs=Math.floor(Amplitude.getSongPlayedSeconds()); let secs=Math.floor(Amplitude.getSongPlayedSeconds());
if(secs%10===0){ if(secs%10===0){
song=Amplitude.getActiveSongMetadata(); song=Amplitude.getActiveSongMetadata();
if(Amplitude.getSongPlayedPercentage()>20){
markSongAsPlayed(song.id)
}
if(Amplitude.getSongPlayedPercentage()>95){ if(Amplitude.getSongPlayedPercentage()>95){
self.removeSongTime(song.id) self.removeSongTime(song.id)
}else{ }else{
@ -992,7 +995,7 @@ div#large-visualization{
} }
time= self.getSavedSongTime(); time= self.getSavedSongTime();
console.log(time) // console.log(time)
if(time>0){ if(time>0){
Amplitude.skipTo(time,0) Amplitude.skipTo(time,0)
} }
@ -1027,6 +1030,26 @@ for( var i = 0; i < songElements.length; i++ ){
}); });
} }
let markedAsPlayed=[];
function markSongAsPlayed(id) {
let endpoint = "markPlayed";
if(markedAsPlayed.indexOf(id)!==-1){
return;
}
markedAsPlayed.push(id);
axios
.get("/podcastitems/" + id + "/" + endpoint, {
isPlayed: status,
})
.then(function (response) {
})
.catch(function (error) {
})
.then(function () {});
return false;
}
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save