public void LoadMovie(bool autoPlay)
 {
     if (_moviePlayer == null)
     {
         _moviePlayer = new AVProWindowsMedia();
     }
     if (_moviePlayer.StartVideo(_filename, _loop, _useNativeFormat))
     {
         _moviePlayer.Volume = _volume;
         if (autoPlay)
         {
             _moviePlayer.Play();
         }
     }
     else
     {
         Debug.LogWarning("Couldn't load movie " + _filename);
         UnloadMovie();
     }
 }
Example #2
0
    private bool StartExtractFrames(string filePath, uint numSamples)
    {
        DestroyTextures();

        if (_movie.StartVideo(filePath, false, true, true))
        {
            _textures = new Texture2D[numSamples];
            _contents = new GUIContent[numSamples];
            for (int i = 0; i < numSamples; i++)
            {
                _contents[i] = new GUIContent(" ");
            }

            uint numFrames = _movie.DurationFrames;
            _frameStep    = numFrames / numSamples;
            _targetFrame  = 0;
            _textureIndex = 0;

            if (!_async)
            {
                _isExtracting = true;
                while (_isExtracting)
                {
                    if (AVProWindowsMediaManager.Instance.TextureConversionMethod == AVProWindowsMediaManager.ConversionMethod.Unity4 ||
                        AVProWindowsMediaManager.Instance.TextureConversionMethod == AVProWindowsMediaManager.ConversionMethod.Unity35_OpenGL)
                    {
                        GL.IssuePluginEvent(AVProWindowsMediaPlugin.PluginID | (int)AVProWindowsMediaPlugin.PluginEvent.UpdateAllTextures);
                    }

                    UpdateExtracting();
                }

                return(false);
            }

            return(true);
        }

        return(false);
    }
    private bool StartExtractFrames(string filePath, uint numSamples)
    {
        DestroyTextures();

        if (_movie.StartVideo(filePath, true, true, false, false, false, false, false, FilterMode.Bilinear, TextureWrapMode.Clamp))
        {
            _textures = new Texture2D[numSamples];
            _contents = new GUIContent[numSamples];
            for (int i = 0; i < numSamples; i++)
            {
                _contents[i] = new GUIContent(" ");
            }

            uint numFrames = _movie.DurationFrames;
            _frameStep    = numFrames / numSamples;
            _targetFrame  = 0;
            _textureIndex = 0;

            if (!_async)
            {
                _isExtracting = true;
                while (_isExtracting)
                {
#if UNITY_5 && !UNITY_5_0 && !UNITY_5_1
                    GL.IssuePluginEvent(AVProWindowsMediaPlugin.GetRenderEventFunc(), (int)AVProWindowsMediaPlugin.PluginEvent.UpdateAllTextures);
#else
                    GL.IssuePluginEvent(AVProWindowsMediaPlugin.PluginID | (int)AVProWindowsMediaPlugin.PluginEvent.UpdateAllTextures);
#endif

                    UpdateExtracting();
                }

                return(false);
            }

            return(true);
        }

        return(false);
    }
Example #4
0
    public bool LoadMovie(bool autoPlay)
    {
        bool result = true;

        if (_moviePlayer == null)
        {
            _moviePlayer = new AVProWindowsMedia();
        }

        bool allowNativeFormat = (_colourFormat != ColourFormat.RGBA32);

        string filePath = Path.Combine(_folder, _filename);

        // If we're running outside of the editor we may need to resolve the relative path
        // as the working-directory may not be that of the application EXE.
        if (!Application.isEditor && !Path.IsPathRooted(filePath))
        {
            string rootPath = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
            filePath = Path.Combine(rootPath, filePath);
        }

        if (_moviePlayer.StartVideo(filePath, _loop, allowNativeFormat, _colourFormat == ColourFormat.YCbCr_HD))
        {
            _moviePlayer.Volume = _volume;
            if (autoPlay)
            {
                _moviePlayer.Play();
            }
        }
        else
        {
            Debug.LogWarning("[AVProWindowsMedia] Couldn't load movie " + _filename);
            UnloadMovie();
            result = false;
        }

        return(result);
    }
    public virtual bool LoadMovie(bool autoPlay)
    {
        bool result = true;

        if (_moviePlayer == null)
        {
            _moviePlayer = new AVProWindowsMedia();
        }

        LoadClips();

        bool allowNativeFormat = (_colourFormat != ColourFormat.RGBA32);

        //string filePath = GetFilePath();
        string filePath = ConfigFile.Cconfig.VediofullPathName;

        if (_moviePlayer.StartVideo(filePath, allowNativeFormat, _colourFormat == ColourFormat.YCbCr_HD, _allowAudio, _useAudioDelay, _useAudioMixer, _useDisplaySync, _ignoreFlips, _textureFilterMode, _textureWrapMode))
        {
            if (_allowAudio)
            {
                _moviePlayer.Volume       = _volume;
                _moviePlayer.AudioBalance = _audioBalance;
            }
            _moviePlayer.Loop = _loop;
            if (autoPlay)
            {
                _moviePlayer.Play();
            }
        }
        else
        {
            Debug.LogWarning("[AVProWindowsMedia] Couldn't load movie " + _filename);
            UnloadMovie();
            result = false;
        }

        return(result);
    }