Javascript - 对象不是集合

时间:2012-03-20 07:48:37

标签: javascript

我尝试用activex创建一个视频对象,但我接受了这个错误:“对象不是一个集合”。这是我的代码,错误从“this.parts = null;”开始。在此行之前可能还有其他导致错误的事情。我在网上搜索这个错误但没有解决它的例子。

function detailKeyPress(evt) {

        var evtobj=window.event? event : evt;
        switch (evtobj.keyCode) {
            case KEYS.OK:
                if (player.isFullScreen == false)
                    player.makeFullScreen();
                else
                    player.makeWindowed();                   
                break;

            case KEYS.PLAY:
                player.isPlaying = true;
                player.object.play(1);
                break;

            case KEYS.PAUSE:
                player.pause();
                break;

            case KEYS.STOP:
                player.makeWindowed();
                player.stop();
                break;
        }
    }

    function Player(id) {
        this.id = id;
        this.object = document.getElementById(id);
        this.isFullScreen = false;           
        this.isPlaying = false;
        this.parts = null;
        return this;
    }

    Player.prototype.play = function () {
        this.isPlaying = true;
        return this.object.play(1);
    }

    Player.prototype.playByUrl = function (url) {
        this.object.data = url;
        return this.play();
    }

    document.onkeydown = function (evt) {
        detailKeyPress(evt);
    }
    window.onload = function () {
        player = new Player('playerObject');
        player.playByUrl($mp4Link);
    }



    Player.prototype.makeFullScreen = function () {
        try {
            this.object.setFullScreen(true);               
            this.isFullScreen = true;               
        }
        catch (ex) {//If philips
            this.object.fullScreen = true;
            this.isFullScreen = true;
        }
    }

    Player.prototype.makeWindowed = function () {
        try {
            this.object.setFullScreen(false);
            this.isFullScreen = false;
        }
        catch (ex) { //If philips
            this.object.fullScreen = false;
            this.isFullScreen = false;
        }
    }

    Player.prototype.pause = function () {
        this.isPlaying = false;
        this.object.play(0);
    }

    Player.prototype.stop = function () {
        this.isPlaying = false;
        this.object.stop();
    }

1 个答案:

答案 0 :(得分:1)

这可能是由您的注册表引起的。如果你清理它,你可以解决或可能是一个错误。我也搜索了很多关于这个错误的信息。没有别的可说的了。