Mobiclip video playback display problem on my Wii project.

_RedFire

Well-Known Member
OP
Member
Joined
May 26, 2020
Messages
231
Trophies
0
XP
1,211
Country
United States
Greetings, I'm currently trying to get videos as Mobiclip formats to display correctly on the Wii's Flash emulator here. I have recoded and builded my own Wii API library for ActionScript. The original libraries go to Nintendo. Anyways, I have my own ActionScript class called, "StoryMode". This class is supposed to attach the video wrapper, gets it's video instance, which the linked video's name is called:
video1
1732833018399.png

calls the WiiVideoPlayback class:

Code:
this._videoInstance = Video(this._videoWrapper.getInstanceByName("video1"));
this._wiiVideoPlayback = new platform.nintendo.wii.media.WiiVideoPlayback(this._videoInstance);
and is supposed to load a video here:
Code:
this._wiiVideoPlayback.load(StoryMode.TRUSTED + StoryMode.STORY + ".mo");
In fact, it does load the file on the Wii. But the problem is that it only plays the audio part and not the video display. I don't know what I did wrong here and I don't really know what type of codec my Mobiclip has. I've used the Mobiclip conversion tool from converting the other video format to the *.mo* format for the Wii.
Here's my two classes, StoryMode and WiiVideoPlayback:
StoryMode:
Code:
class StoryMode extends sugar.core.UIMovieClip
{
    var container;
    var _source;
    var _queuedSeekPos;
    var systemVideoPlayer;
    var _videoWrapper;
    var _videoInstance;
    var _wiiVideoPlayback;
    var _timeline;
    var _isVideoMasked;
    static var instance;
    static var TRUSTED = "file://videos/";
    static var STORY = "story";
    var _maskTargetDepot = {};
    var _isVideoLoaded = false;
    function StoryMode()
    {
        super.init();
        super.updateDisplay();
        this.buildVideoPlayer();
        this.autoPlay = true;
    }
    static function getInstance()
    {
        if (StoryMode.instance == null || StoryMode.instance == undefined)
        {
            StoryMode.instance = new StoryMode();
        }
        return StoryMode.instance;
    }
    function get timeline()
    {
        return this._timeline;
    }
    function buildVideoPlayer()
    {
        super.updateDisplay();
        this._videoWrapper = sugar.core.UIMovieClip(this.attachMovie("VideoWrapper", "_videoWrapper", this.getNextHighestDepth()));
        this._videoInstance = Video(this._videoWrapper.getInstanceByName("video1"));
        this._wiiVideoPlayback = new platform.nintendo.wii.media.WiiVideoPlayback(this._videoInstance);
        this._wiiVideoPlayback.videoCodec = 1;
        this._wiiVideoPlayback.load(StoryMode.TRUSTED + StoryMode.STORY + ".mo");
        this._wiiVideoPlayback.show();
        this.autoPlay = true;
        this.maximize();
        this._videoWrapper._visible = true;
    }
    function drawMask()
    {
        this._videoWrapper.clear();
        this._videoWrapper.beginFill(16711680, 0);
        sugar.utils.GeomUtil.drawRect(this._videoWrapper, 0, 0, this._videoWrapper.width, this._videoWrapper.height);
        this._videoWrapper.endFill();
    }
    function set autoPlay(value)
    {
        this._wiiVideoPlayback.autoplay = value;
    }


    function get autoPlay()
    {
        return this._wiiVideoPlayback.autoplay;
    }
    function maximize()
    {
        this._videoWrapper.setActualSize(sugar.core.WiiSugarApplication.stageWidth, sugar.core.WiiSugarApplication.stageHeight);
        this._videoWrapper.x = 0;
        this._videoWrapper.y = 0;
    }
    function destroy()
    {
        if (this._wiiVideoPlayback != null)
        {
            this._wiiVideoPlayback.destroy();
            this._wiiVideoPlayback = null;
        }
        if (this._videoWrapper != null)
        {
            this._videoWrapper.removeMovieClip();
            this._videoWrapper = null;
        }
    }
}
WiiVideoPlayback:
Code:
class platform.nintendo.wii.media.WiiVideoPlayback extends platform.nintendo.wii.core.WiiEventDispatcher
{
    var video;
    var _eKeyIndex;
    var _videoHURL;
    var _videoURL;
    var dispatchEvent;
    var _eventInterval;
    static var CODEC_AUTO_DETECT = -1;
    static var CODEC_H264 = 0;
    static var CODEC_MOBI = 1;
    static var _overlayEnabled = false;
    static var _overlayKeyColor = 0;
    static var _overlayAlpha = 100;
    static var _playbackThreshold = 24;
    var autoplay = true;
    var dispatchContinuousEvents = true;
    var eventFrequency = 500;
    var _originalDimValue = platform.nintendo.wii.Wii.dimmingEnabled;
    var _originalHBMValue = platform.nintendo.wii.Wii.homeButtonEnabled;
    var _isIntervalRunning = false;
    var _state = platform.nintendo.wii.media.WiiVideoState.STOPPED;
    var _cType = platform.nintendo.wii.media.WiiVideoPlayback.CODEC_AUTO_DETECT;
    var _isPlaying = false;
    var _isSeeking = false;
    function WiiVideoPlayback(pVideo)
    {
        super();
        if (!pVideo)
        {
            throw new platform.nintendo.wii.core.WiiError(platform.nintendo.wii.core.WiiError.GENERAL_ERROR, "An error has occurred because the WiiVideoPlayback's video instance is required on construction.");
        }
        this.video = pVideo;
        this.video.onStatus == mx.utils.Delegate.create(this, this.videoOnStatus);
        this.video.play();
    }
    static function get overlayEnabled()
    {
        return platform.nintendo.wii.media.WiiVideoPlayback._overlayEnabled;
    }
    static function set overlayEnabled(pValue)
    {
        platform.nintendo.wii.media.WiiVideoPlayback._overlayEnabled = pValue;
        _global.my.extensions.WiiSystem.videoRenderMode(platform.nintendo.wii.media.WiiVideoPlayback._overlayEnabled,platform.nintendo.wii.media.WiiVideoPlayback._overlayKeyColor,platform.nintendo.wii.media.WiiVideoPlayback._overlayAlpha);
    }
    static function get overlayKeyColor()
    {
        return platform.nintendo.wii.media.WiiVideoPlayback._overlayKeyColor;
    }
    static function set overlayKeyColor(pValue)
    {
        platform.nintendo.wii.media.WiiVideoPlayback._overlayKeyColor = pValue;
        _global.my.extensions.WiiSystem.videoRenderMode(platform.nintendo.wii.media.WiiVideoPlayback._overlayEnabled,platform.nintendo.wii.media.WiiVideoPlayback._overlayKeyColor,platform.nintendo.wii.media.WiiVideoPlayback._overlayAlpha);
    }
    static function get overlayAlpha()
    {
        return platform.nintendo.wii.media.WiiVideoPlayback._overlayAlpha;
    }
    static function set overlayAlpha(pValue)
    {
        platform.nintendo.wii.media.WiiVideoPlayback._overlayAlpha = pValue;
        _global.my.extensions.WiiSystem.videoRenderMode(platform.nintendo.wii.media.WiiVideoPlayback._overlayEnabled,platform.nintendo.wii.media.WiiVideoPlayback._overlayKeyColor,platform.nintendo.wii.media.WiiVideoPlayback._overlayAlpha);
    }
    function get state()
    {
        return this._state;
    }
    function get bytesLoaded()
    {
        return int(this.video.bytesLoaded());
    }
    function get bytesTotal()
    {
        return int(this.video.bytesTotal());
    }
    function get currentFrame()
    {
        return int(this.video.getCurrentFrame());
    }
    function get elapsedTime()
    {
        return int(this.video.time());
    }
    function get totalTime()
    {
        return int(this.video.totalTime());
    }
    function get width()
    {
        return int(this.video.getWidth());
    }
    function get height()
    {
        return int(this.video.getHeight());
    }
    function get isPlaying()
    {
        return this._isPlaying;
    }
    function get playbackThreshold()
    {
        return platform.nintendo.wii.media.WiiVideoPlayback._playbackThreshold;
    }
    function set playbackThreshold(pValue)
    {
        if (pValue > 0 && pValue <= 32)
        {
            platform.nintendo.wii.media.WiiVideoPlayback._playbackThreshold = pValue;
        }
        this.video.setPlaybackThreshold(platform.nintendo.wii.media.WiiVideoPlayback._playbackThreshold);
    }
    function get deviceVideoInstance()
    {
        return this.video;
    }
    function get encryptionKeyIndex()
    {
        return this._eKeyIndex;
    }
    function set encryptionKeyIndex(pKeyIndex)
    {
        this._eKeyIndex = pKeyIndex;
    }
    function get videoHeaderURL()
    {
        return this._videoHURL;
    }
    function set videoHeaderURL(pHeaderURL)
    {
        this._videoHURL = pHeaderURL;
    }
    function get videoCodec()
    {
        return this._cType;
    }
    function set videoCodec(pVideoCodec)
    {
        this._cType = pVideoCodec;
    }
    function load(pURL)
    {
        this._videoURL = pURL;
        this._isPlaying = this.autoplay;
        this._state = platform.nintendo.wii.media.WiiVideoState.LOADING;
        this.video.setVideoType(this._cType);
        if (!isNaN(this._eKeyIndex))
        {
            this.video.setEncryptionKey(this._eKeyIndex);
        }
        if (this._videoHURL)
        {
            this.video.setHeaderURL(this._videoHURL);
        }
        this.video.play(this._videoURL);
    }
    function play()
    {
        if (this._state == platform.nintendo.wii.media.WiiVideoState.PLAYING || this._isPlaying == true)
        {
            return undefined;
        }
        if (this._state == platform.nintendo.wii.media.WiiVideoState.STOPPED)
        {
            this.load(this._videoURL);
            return undefined;
        }
        this._isPlaying = true;
        this._state = platform.nintendo.wii.media.WiiVideoState.PLAYING;
        this.video.resume();
    }
    function pause()
    {
        if (this._state == platform.nintendo.wii.media.WiiVideoState.PAUSED || this._isPlaying == false)
        {
            return undefined;
        }
        this._isPlaying = false;
        this._state = platform.nintendo.wii.media.WiiVideoState.PAUSED;
        this.video.pause();
    }
    function stop()
    {
        if (this._state == platform.nintendo.wii.media.WiiVideoState.STOPPED)
        {
            return undefined;
        }
        this._isPlaying = false;
        this._state = platform.nintendo.wii.media.WiiVideoState.STOPPED;
        this.stopEventInterval();
        this.video.stop();
    }
    function show()
    {
        this.video.showVideo();
    }
    function hide()
    {
        this.video.hideVideo();
    }
    function captureFrame(pWidth, pHeight)
    {
        if (pWidth == undefined)
        {
            pWidth = int(this.video.getWidth());
        }
        if (pHeight == undefined)
        {
            pHeight = int(this.video.getHeight());
        }
        return flash.display.BitmapData(_global.my.extensions.WiiSystem.getVideoFrame(pWidth, pHeight));
    }
    function reset()
    {
        this.seek(0);
    }
    function seek(pTime)
    {
        this.video.seek(pTime);
    }
    function destroy()
    {
        stop();
        this.video.close();
        this.video = null;
        this.autoplay = null;
    }
    function onError(pErrorCode)
    {
        platform.nintendo.wii.Wii.dimmingEnabled = this._originalDimValue;
        platform.nintendo.wii.Wii.homeButtonEnabled = this._originalHBMValue;
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoErrorEvent(pErrorCode, this));
    }
    function onBuffered()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.BUFFERED, this));
    }
    function onBuffering()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.BUFFERING, this));
    }
    function onRemoteConnectionRetry()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.REMOTE_CONNECTION_RETRY, this));
    }
    function onCompleted()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.COMPLETED, this));
    }
    function onLoaded()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.LOADED, this));
    }
    function onLoading()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.LOADING, this));
    }
    function onPaused()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.PAUSED, this));
    }
    function onPlaying()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.PLAYING, this));
    }
    function onResume()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.PLAYING, this));
    }
    function onStopped()
    {
        this.dispatchEvent(new platform.nintendo.wii.media.WiiVideoEvent(platform.nintendo.wii.media.WiiVideoEvent.STOPPED, this));
    }
    function startEventInterval()
    {
        if (this.dispatchContinuousEvents == false || this._isIntervalRunning == true)
        {
            return undefined;
        }
        this._eventInterval = setInterval(this, "eventIntervalOnInterval", this.eventFrequency);
        this.eventIntervalOnInterval();
        this._isIntervalRunning = true;
    }
    function stopEventInterval()
    {
        if (this.dispatchContinuousEvents == false || this._isIntervalRunning == false)
        {
            return undefined;
        }
        clearInterval(this._eventInterval);
        this._isIntervalRunning = false;
    }
    function setDimming()
    {
        if (this._state == platform.nintendo.wii.media.WiiVideoState.RESUME || this._state == platform.nintendo.wii.media.WiiVideoState.PLAYING || this._state == platform.nintendo.wii.media.WiiVideoState.BUFFERED)
        {
            platform.nintendo.wii.Wii.dimmingEnabled = false;
        }
        else
        {
            platform.nintendo.wii.Wii.dimmingEnabled = this._originalDimValue;
        }
    }
    function setHBM()
    {
        if (this._state == platform.nintendo.wii.media.WiiVideoState.LOADING || this._state == platform.nintendo.wii.media.WiiVideoState.BUFFERED)
        {
            platform.nintendo.wii.Wii.homeButtonEnabled = false;
        }
        else
        {
            platform.nintendo.wii.Wii.homeButtonEnabled = this._originalHBMValue;
        }
    }
    function eventIntervalOnInterval()
    {
        switch (this._state)
        {
            case platform.nintendo.wii.media.WiiVideoState.LOADING :
                this.onLoading();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoState.BUFFERING :
                this.onBuffering();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoState.RESUME :
                this._state = platform.nintendo.wii.media.WiiVideoState.PLAYING;
                this._isPlaying = true;
                break;
            case platform.nintendo.wii.media.WiiVideoState.PLAYING :
                break;
            default :
                this.stopEventInterval();
        }
        this.onPlaying();
        return undefined;
    }
    function videoOnStatus(pEvent)
    {
        if (pEvent.level == platform.nintendo.wii.core.WiiEvent.LEVEL_ERROR)
        {
            this.stopEventInterval();
            this.onError(pEvent.code);
            return undefined;
        }
        if (pEvent.code == platform.nintendo.wii.media.WiiVideoEvent.REMOTE_CONNECTION_RETRY)
        {
            this.onRemoteConnectionRetry();
            return undefined;
        }
        this._state = pEvent.code;
        this.setDimming();
        this.setHBM();
        switch (this._state)
        {
            case platform.nintendo.wii.media.WiiVideoEvent.LOADING :
                this.startEventInterval();
                this.onLoading();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.LOADED :
                this.stopEventInterval();
                if (this.autoplay == false)
                {
                    this.pause();
                }
                this.onLoaded();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.BUFFERING :
                this.startEventInterval();
                this.onBuffering();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.BUFFERED :
                this.stopEventInterval();
                this.onBuffered();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.PAUSED :
                this.stopEventInterval();
                this.onPaused();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.RESUME :
                this.startEventInterval();
                this.onResume();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.PLAYING :
                this.startEventInterval();
                this.onPlaying();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.COMPLETED :
                this.onCompleted();
                return undefined;
            case platform.nintendo.wii.media.WiiVideoEvent.STOPPED :
                this.onStopped();
                return undefined;
            default :
        }
    }
}
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • SylverReZ @ SylverReZ:
    @The_Dizzy_Vizzy, Mine has been like this ever since I was born, mate. I've gotten all sorts of problems, such as, but is not limited to: sore throats, colds, stomache bugs, etc.
  • SylverReZ @ SylverReZ:
    Honestly, I feel for you. Keep yourself nice and cosy, drink plenty and take some anti-biotics.
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Dude, when you get bronchitis, you get a fever, body aches, the sweats, and sometimes vomiting...
  • SylverReZ @ SylverReZ:
    @The_Dizzy_Vizzy, Yeah. That's the worst feeling ever when you get it.
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Damn dude, I feel for you. That blows. You know, being sick as a kid was sometimes fun, because you could do anything when your parents were away. On the other hand, being sick when you are an adult is murder on your system, and your BOSS wants a fucking doctor's note...
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    @Syl, are you in Europe?
  • SylverReZ @ SylverReZ:
    @The_Dizzy_Vizzy, UK. So part of Europe, except we left the EU ages ago. 😅
  • kijetesantakalu042 @ kijetesantakalu042:
    Do you guys ever feel jealous for people who die on the news?
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Like that news anchor (or weatherman or some shit) over here in the states who blew his head off right in the middle of LIVE TV??
  • kijetesantakalu042 @ kijetesantakalu042:
    @The_Dizzy_Vizzy 9/10 death. Sounds quick and painless
  • kijetesantakalu042 @ kijetesantakalu042:
    But I mean like people who die and then are reported on the news like "He died while jerking off"
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    I guess so... Do you feel that bodily death is the annihilation of consciousness?:
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Well, we all get a slice of life, that's for SURE.
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    @KJ, what continent do you live on?
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Some people are finicky about sharing this stuff, but I am simply asking out of curiosity. I myself live in the USA...
  • SylverReZ @ SylverReZ:
    @The_Dizzy_Vizzy, I'm curious whether the USA looks bad compared to what the media shows. Some places are relaxed and chill.
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Currently watching "Shin Godzilla", great flick, and the meanest version of Godzilla EVER...
  • K3Nv2 @ K3Nv2:
    It depends on the region zone some areas stay hotter than others
  • K3Nv2 @ K3Nv2:
    If it snowed in Florida there's probably be massive shootings and innocent deaths
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    Dude, this country has just elected DONALD FUCKING TRUMP as the President of the United States. Trust my @Syl, this is NOT a good thing...
  • The_Dizzy_Vizzy @ The_Dizzy_Vizzy:
    @K3, you must live here...
  • SylverReZ @ SylverReZ:
    @The_Dizzy_Vizzy, Yeah, Trump is a massive cock. I don't love what he has to say.
    SylverReZ @ SylverReZ: @The_Dizzy_Vizzy, Yeah, Trump is a massive cock. I don't love what he has to say.