var player = null;
function loadStream(url) {
    //player.setMediaResourceURL(url);
	
	player = cyberplayer("playercontainer").setup({
		width: 896,
		height: 504,
		file: url, // <—rtmp直播地址
		autostart: true,
		stretching: "uniform",
		volume: 100,
		controls: true,
		rtmp: {
			reconnecttime: 10, // rtmp直播的重连次数
			bufferlength: 0 // 缓冲多少秒之后开始播放 默认1秒
		}
	});
}

function getlink(url) {
    return "/index.html?src=" + encodeURIComponent(url);
}

function jsbridge(playerId, event, data) {
    if (player == null) {
        player = document.getElementById(playerId);
    }
    switch(event) {
        case "onJavaScriptBridgeCreated":
        listStreams(teststreams,"streamlist");
        break;
        case "ready":userSubmit();break;
        case "timeChange":
        case "timeupdate":
        case "progress":
        break;
        default:
        console.log(event, data);
    }
}

function userSubmit() {
    //window.location = getlink(document.getElementById('userInput').value);
    loadStream(document.getElementById('userInput').value);
};
