window.onload = function() {
    document.getElementById('player_display_track_metadata').onchange = generateEmbedSrc;
}

function generateEmbedSrc()
{

}


function generateEmbedSrc()
{
    var $embedCodeParams = "?";
    var $streamMode = getStreamMode();
    if ($streamMode == "b") {
        var $stream = $("input[name=player_stream_url]:radio:checked").val();
        $embedCodeParams += "stream-mode=b&stream="+$stream;
    } else if ($streamMode == "a") {
        $embedCodeParams += "stream-mode=a";
    }
    $embedCodeParams += "\"";

    $("input[name=player_embed_src]").val(function(index, value) {
        return value.replace(/\?.*?"/, $embedCodeParams);
    });
}

function getStreamMode() {
    return $("input[name=player_stream_mode]:radio:checked").val();
}

$(document).ready(function() {
    $("#player_stream_mode-element").change(function() {
        var $streamMode = getStreamMode();
        if ($streamMode == "a") {
            $("#player_stream_url-element input[type='radio']").attr("disabled", "disabled");
        } else if ($streamMode == "b") {
            $("#player_stream_url-element input[type='radio']").removeAttr("disabled");
        }

        generateEmbedSrc();
    });

    $("#player_stream_url-element").change(function() {
        generateEmbedSrc();
    });
});


Embed Player -> Update embed src code and preview when an option changes
SAAS-644: Embed Player -> Update embed src code and preview when an option changes
