var livePlayer = {
    'winHeight': $(window).height(),
    'winWidth':  $(window).width(),
    'isUserFullScreen': false,
    'isDocFullScreen': false,

    init: function () {
        this.winHeight = $(window).height();
        this.winWidth = $(window).width();

        this.playerSize();

        $('.infobox').width($(window).width() - 30);

        if (this.isPortrait()) {
            $('.docfullbtn2').show();

            if (this.isDocFullScreen) {
                $('#ppts').css({
                    'height': this.winHeight,
                    'width': this.winWidth,
                    'padding-top': ''
                });
                $('#drawPanel,#dpa').css({
                    'margin-top': ''
                });
            } else {
                this.exitFullscreen();
            }

        } else {
            if (!this.isiPad()) {
                this.fullscreen();
            }

            $('.docfullbtn2').hide();
            if (this.isDocFullScreen) {
                $('#ppts').css({
                    'height': this.winHeight,
                    'width': this.winWidth,
                    'text-align': 'center',
                    'padding-top': 40
                });
                $('#drawPanel,#dpa').css({
                    'margin-top': 40
                });
            }
        }
    },

    playerSize: function () {
        $('#webPlayer').css({
            'width': '100%',
            'height': '100%'
        });
    },

    topHalfHeight: function () {
        var h;
        if (livePlayer.isiPad() && !this.isPortrait()) {
            h = this.winHeight / 2; // iPad---横屏
        } else {
            h = this.winWidth * 9 / 16;
        }
        console.log('topHalfHeight ====>>>', h)
        $('#topHalf').height(h);
        return h;
    },

    chatQaFold: function (hasAnimate) {
        var that = this;
        var bottomHalf = $('#bottomHalf');
        var headerHeight = 5;
        if ($('.toolbar').hasClass('toolbar-show')) {
            headerHeight = 2 * headerHeight;
        }
        var animateTime = hasAnimate ? 200 : 0;
        bottomHalf.find('.slider-bd').each(function () {
            var self = $(this);
            var topBtmHeight = (self.siblings('.slider-ft').length == 1) ? 75 : 35;

            console.log('--->>>>', that.winHeight, that.topHalfHeight(), topBtmHeight, headerHeight)
            self.css({
                'height': that.winHeight - that.topHalfHeight() - topBtmHeight - headerHeight,
                'transition-duration': animateTime + 'ms',
                '-webkit-transition-duration': animateTime + 'ms',
                '-moz-transition-duration': animateTime + 'ms'
            });
        });
        setTimeout(function () {
            bottomHalf.removeClass('section-bottom-unfold');
        }, animateTime);
        $('#foldBtn').removeClass('icon-cam-off');
    },

    fullscreen: function () {
        $('#topHalf').css({
            'height': this.winHeight - 0,
            'z-index': '99'
        });
    },

    exitFullscreen: function () {
        $('#topHalf').css({
            'height': this.topHalfHeight(),
            'z-index': '1'
        });
    },

    isiPhone: function () {
        return /iphone/i.test(navigator.userAgent);
    },
    isiPad: function () {
        return /iPad/i.test(navigator.userAgent);
    },
    isUcOrQqBrowser: function () {
        return /ucbrowser/i.test(navigator.userAgent) || /mqqbrowser/i.test(navigator.userAgent);
    },
    isPortrait: function () {
        return window.isPortrait;
    }
};
var opts = {
    'roomId': $('#roomId').val(),
    'userId': $('#userId').val(),
    'viewerId': $('#viewerId').val(),
    'recordId': $('#recordId').val(),
    'upId': $('#upId').val()
};
