

function isIOS() {
    return navigator.userAgent.match(/((iPod)|(iPhone)|(iPad))/i);
}

function createFlowPlayer() {
    flowplayer('player', {
            src: '/untvweb/swf/flowplayer-3.2.6.swf',
            wmode: 'transparent'
        }, {
        clip: {
            autoPlay: true,
            provider: 'rtmp',
            live: true,
            netConnectionUrl: 'rtmp://64.151.108.10/livestream',
            url: 'untvwebstream'
        },
        plugins: {
            controls: {
                url: '/untvweb/swf/flowplayer.controls-3.2.4.swf',
                autoHide: 'always', // always, fullscreen, never
                // controls
                all: false,
                volume: true,
                mute: true,
                stop: true,
                fullscreen: true,
                // colors
                volumeSliderColor: '#232323',
                volumeColor: '#DDDDDD',
                // display
                backgroundImage: '',
                backgroundColor: 'rgba(20, 20, 20, 0.4)',
                backgroundGradient: [0,0]
            },
            rtmp: {
                url: '/untvweb/swf/flowplayer.rtmp-3.2.3.swf'
            }
        }
    });
}

function createHtml5Video() {
    var url = 'http://64.151.108.10/hls-live/livestream/_definst_/untvweb/untvwebstream.m3u8';
    $('#player').html('<video width="100%" height="100%" src="'+ url +
        '" controls="controls" autoplay="autoplay"/>');
}


$(function() {
    if (isIOS()) {
        createHtml5Video();
    } else {
        createFlowPlayer();
    }
});

