var playerEmbed = {
    prontus_id: '',
    hostUrl: '',
    // Config predeterminada

    init: function () {
        var url = window.location.href;
        var src = "";
        var splitted = url.split('?');
        if (typeof splitted[1] === 'undefined') {
            return;
        }
        var temp;
        var args = splitted[1].split(/&/);
        for (var i = 0; i < args.length; i++) {
            temp = args[i].split(/=/);
            if (temp[0] === "src") {
                src = temp[1];
                break;
            }
        }
        temp = src.split('/');
        if (temp.length > 1) {
            playerEmbed.prontus_id = temp[1];
        }
        temp = window.location.href.split('/');
        if (temp.length > 2) {
            playerEmbed.hostUrl = temp[0] + '//' + temp[2];
        }
        playerEmbed.install(src);
    },

    install: function (src) {
        var fullSrc = playerEmbed.hostUrl + src;

        prontusAudioPlayer.mediaController.install({
            "mediaSrc": {
                "defaultSrc": fullSrc
            }
        });
    }
};
