settingcheck.as

来自「最为强大的个人版播客系统!专用的个人视频源码」· AS 代码 · 共 72 行

AS
72
字号
//Created by Action Script Viewer - http://www.buraks.com/asv
    class com.fivesix.SettingCheck
    {
        var video, user_cam, broadcastMessage;
        function SettingCheck (target_video) {
            video = target_video;
            user_cam = Camera.get();
        }
        function startCheck() {
            this.broadcastMessage("onStarted");
            checkMic();
        }
        function checkMic() {
            var _local2 = Microphone.names;
            var _local3 = Camera.names;
            if (_local2.length < 1) {
                this.broadcastMessage("onMicNotFound");
            } else if (_local3.length < 1) {
                this.broadcastMessage("onCamNotFound");
            } else {
                checkAllowable();
             }
        }
        function checkAllowable() {
            var owner = this;
            var _local2 = Microphone.get();
            var _local3 = new NetConnection ();
            _local3.connect(null);
            var test_ns = new NetStream (_local3);
            test_ns.attachAudio(_local2);
            _local2.onStatus = function (infoObj) {
                if (infoObj.code == "Microphone.Unmuted") {
                    test_ns.attachAudio(null);
                    test_ns.close();
                    owner.checkCamBusy();
                } else {
                    owner.broadcastMessage("onCamBlockedByUser");
                 }
            };
            if (_local2.muted || (user_cam.muted)) {
                this.broadcastMessage("onCamBlocked");
            } else {
                test_ns.attachAudio(null);
                test_ns.close();
                checkCamBusy();
             }
        }
        function checkCamBusy() {
            function callback() {
                if (owner.user_cam.currentFps > 0) {
                    owner.video.attachVideo(null);
                    owner.broadcastMessage("onFinished");
                    clearInterval(intervalID);
                } else {
                    chkTime++;
                    if (chkTime > 30) {
                        owner.video.attachVideo(null);
                        owner.broadcastMessage("onCamBusy");
                        clearInterval(intervalID);
                    }
                 }
            }
            this.broadcastMessage("onCheckCamBusy");
            video.attachVideo(user_cam);
            var owner = this;
            var chkTime = 0;
            var intervalID;
            intervalID = setInterval(callback, 50);
        }
        static var broadcastInit = AsBroadcaster.initialize(com.fivesix.SettingCheck.prototype);
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?