{"id":18953,"date":"2014-01-04T13:49:17","date_gmt":"2014-01-04T13:49:17","guid":{"rendered":"https:\/\/es.wordpress.org\/support\/topic\/customize-total-control-html5-audio-player-basic-plugin\/"},"modified":"2016-08-06T00:23:06","modified_gmt":"2016-08-06T00:23:06","slug":"customize-total-control-html5-audio-player-basic-plugin","status":"closed","type":"topic","link":"https:\/\/es.wordpress.org\/support\/topic\/customize-total-control-html5-audio-player-basic-plugin\/","title":{"rendered":"Personalizar plugin \u201cTotal Control HTML5 Audio Player Basic\u201d"},"content":{"rendered":"<p>Hola,<br \/>\nEstoy personalizando el plugin \u00abTotal Control HTML5 Audio Player Basic\u00bb. Tengo el siguiento c\u00f3digo que reemplaza las canciones de la lista de reproducci\u00f3n:<\/p>\n<pre><code>$(document).on(&#039;click&#039;, &#039;.playOnAP&#039;,function() {\n    if( $(this).hasClass(&#039;playOnAP-pause&#039;) ) {\n        htmlSound.pause();\n        $(this).removeClass(&#039;playOnAP-pause&#039;);\n        $(&#039;.total-play&#039;).removeClass(&#039;total-pause&#039;);\n    } else {\n\n        var tituloAlbum = $(this).siblings( &#039;.entry-header&#039; ).text();\n        var caratula = $(this).siblings( &#039;.thumbnail-review&#039; ).children().html();\n        var artista = $(this).siblings( &#039;.artista&#039; ).text();\n\n        $(&#039;.playOnAP&#039;).removeClass(&#039;playOnAP-pause&#039;);\n\n        if( supports_mp3_audio() ) {\n\n            var clon = $(&#039;.total-row&#039;).first().clone(true)\n            $(&#039;.total-row&#039;).remove();\n            $(&#039;#mp3-list ul li&#039;,this).each( function( index, element ) {\n\n                $(&#039;.jspPane&#039;).append(clon.clone(true));\n                var totalTitle = $(&#039;.total-title&#039;).eq(index);\n\n                totalTitle.attr(&#039;src&#039;, $(this).text() );                                            \/\/url canci\u00f3n\n                totalTitle.text($(this).text().slice(($(this).text().search(&quot;\\\/[^\\\/]+$&quot;)) + 1));    \/\/canci\u00f3n\n                totalTitle.siblings( &#039;.total-artist&#039; ).text(artista);                               \/\/artista\n                totalTitle.attr(&#039;imagen&#039;, caratula);\n                });\n            $(this).addClass(&#039;playOnAP-pause&#039;);\n        } else if ( supports_ogg_audio() ) {\n\n            var clon = $(&#039;.total-row&#039;).first().clone(true)\n            $(&#039;.total-row&#039;).remove();\n            $(&#039;#ogg-list ul li&#039;,this).each( function( index, element ) {\n                $(&#039;.jspPane&#039;).append(clon.clone(true));\n                var totalTitle = $(&#039;.total-title&#039;).eq(index);\n\n                totalTitle.attr(&#039;src&#039;, $(this).text() );                                            \/\/url canci\u00f3n\n                totalTitle.text($(this).text().slice(($(this).text().search(&quot;\\\/[^\\\/]+$&quot;)) + 1));    \/\/canci\u00f3n\n                totalTitle.siblings( &#039;.total-artist&#039; ).text(artista);                               \/\/artista\n                totalTitle.attr(&#039;imagen&#039;, caratula);\n                });\n            $(this).addClass(&#039;playOnAP-pause&#039;);\n        }\n        totalSongs = $(&#039;.total-title&#039;).length;\n        songPlay($(&#039;.total-title&#039;).first().attr(&#039;src&#039;));\n        htmlSound.play(); \n\n        $(&#039;.total-play&#039;).addClass(&#039;total-pause&#039;);\n        $(&#039;#caratula&#039;).html($(&#039;.total-title&#039;).first().attr(&#039;imagen&#039;))\n    }\n    });<\/code><\/pre>\n<p>El problema viene cuando intento a\u00f1adir canciones a la lista de reproducci\u00f3n sin cambiar la canci\u00f3n que suena en ese momento. He intentado lo siguiente:<\/p>\n<pre><code>$(document).on(&#039;click&#039;, &#039;.addOnAP&#039;,function() {\n        var currentSrc = $(&#039;.total-playing .total-playing&#039;).attr(&#039;src&#039;);\n        if( $(&#039;.total-title&#039;).length &lt;= 20 ) {\n            var tituloAlbum = $(this).siblings( &#039;.entry-header&#039; ).text();\n            var caratula = $(this).siblings( &#039;.thumbnail-review&#039; ).children().html();\n            var artista = $(this).siblings( &#039;.artista&#039; ).text();\n\n            if( supports_mp3_audio() ) {\n                console.log(&#039;soporta ogg&#039;);             \n\n                $(this).siblings(&#039;.playOnAP&#039;).find(&#039;#mp3-list ul li&#039;).each( function( index, element ) {\n                    $(&#039;.total-row&#039;).first().clone(true).insertAfter($(&#039;.total-row&#039;).last());\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).attr(&#039;src&#039;, $(this).text() );                                           \/\/url canci\u00f3n\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).text($(this).text().slice(($(this).text().search(&quot;\\\/[^\\\/]+$&quot;)) + 1));   \/\/canci\u00f3n\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).siblings( &#039;.total-artist&#039; ).text(artista);                              \/\/artista\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).attr(&#039;imagen&#039;, caratula);\n                    playerHtml += $(&#039;.total-row&#039;).last().html();\n                    totalSongs++;\n                    \/\/songPlay($(&#039;.total-title&#039;).last().attr(&#039;src&#039;));\n                });\n            } else if ( supports_ogg_audio() ) {\n\n                console.log(&#039;soporta ogg&#039;);             \n\n                console.log($(&#039;.total-row&#039;).first());\n                $(this).siblings(&#039;.playOnAP&#039;).find(&#039;#ogg-list ul li&#039;).each( function( index, element ) {\n                    $(&#039;.total-row&#039;).first().clone(true).insertAfter($(&#039;.total-row&#039;).last());\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).attr(&#039;src&#039;, $(this).text() );                                           \/\/url canci\u00f3n\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).text($(this).text().slice(($(this).text().search(&quot;\\\/[^\\\/]+$&quot;)) + 1));   \/\/canci\u00f3n\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).siblings( &#039;.total-artist&#039; ).text(artista);                              \/\/artista\n                    $(&#039;.total-row&#039;).last().find(&#039;.total-title&#039;).attr(&#039;imagen&#039;, caratula);       \n\n                });\n            }\n            totalSongs = $(&#039;.total-title&#039;).length;\n            htmlSound.load(); \n\n        }\n    });<\/code><\/pre>\n<p>pero la canci\u00f3n deja de sonar. He intentado m\u00e1s opciones, pero sin \u00e9xito. Si omito la funci\u00f3n <code><\/code>htmlSound.load();`, las canciones no son a\u00f1adidas al manejador de eventos y no se reproducen cuando termina la canci\u00f3n anterior. \u00bfPuede alguien ayudarme a encontrar la soluci\u00f3n?<\/p>\n","protected":false},"template":"","class_list":["post-18953","topic","type-topic","status-closed","hentry","topic-tag-audio","topic-tag-jplayer","topic-tag-plugins"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/es.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/es.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/es.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/es.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18953\/revisions"}],"wp:attachment":[{"href":"https:\/\/es.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}