Ejemplo n.º 1
0
        private void CurrentBrowser_YouTubeDownloadComplete(object sender, EventArgs e)
        {
            Invoke((MethodInvoker) delegate
            {
                uiDownloadProgressBar.Visible = false;
                DialogResult dialogRes;
                string fileName;
                string dateAndtime;

                using (VideoPreviewer vidPreviewer = new VideoPreviewer(Enums.Actions.Video))
                {
                    dialogRes   = vidPreviewer.ShowDialog();
                    fileName    = vidPreviewer.FileName + vidPreviewer.FileExtension;;
                    dateAndtime = vidPreviewer.DateAndTime;
                }

                if (dialogRes != DialogResult.OK)
                {
                    return;
                }

                DisplaySavedLabel(fileName, dateAndtime);
                ImageDiskCache.RemoveSpecificItemFromCache(Constants.TempVideoFile);
            });
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Inits the file list and init textures preview...
    /// </summary>
    public void InitFileList()
    {
        //
        DeserializeAndRead();

        //get texture...
        if (null == dicFileItems)
        {
            dicFileItems = new FileList();
        }
        List <FileItem> dicFileList = dicFileItems.lstFileItems;
        List <FileItem> deleteList  = new List <FileItem>();

        foreach (var item in dicFileList)
        {
            //if ( countIndex < item.Key )
            //countIndex = item.Key;

            //FileItem file
            if (item._fileType == FileItem.FileType.FileType_Video)
            {
                //string filePath = "file://" + item.Value.
                OpenFileNameEx fileinfo = item._fileInfo;
                string         filePath = "file:///" + fileinfo.file;
                Texture2D      texture  = VideoPreviewer.Instance().LoadTexture(filePath);
                if (texture == null)
                {
                    deleteList.Add(item);
                    continue;
                }

                Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                string key    = GetFileShortName(filePath);
                FileListControl.Instance().AddPreViewSprite(key, sprite);
            }
            else if (item._fileType == FileItem.FileType.FileType_Web)
            {
                string    weburl  = item._webUrl;
                Texture2D texture = WebPreviewer.Instance().LoadTexture(weburl);
                if (texture == null)
                {
                    deleteList.Add(item);
                    continue;
                }

                Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                string key    = GetUrlShortName(weburl);
                FileListControl.Instance().AddPreViewWeb(key, sprite);
            }
        }

        foreach (var itemDel in deleteList)
        {
            dicFileList.Remove(itemDel);
        }

        Save();
    }
Ejemplo n.º 3
0
    public void TestLoadPicture()
    {
        Texture2D texture       = VideoPreviewer.Instance().LoadTexture("file:///C:/Unity3d/dangmu/dangmu/Assets/Dangmu/Textures/WeChat_20180305193437.mp4");
        Sprite    preViewSprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height),
                                                new Vector2(0.5f, 0.5f));

        previewImage.sprite = preViewSprite;

        Debug.Log("TestLoadPicture##successed:" + preViewSprite.name);
    }
Ejemplo n.º 4
0
 private void Init()
 {
     SetEGLContextClientVersion(2);
     Holder.SetFormat(Android.Graphics.Format.Translucent);
     Holder.SetFormat(Android.Graphics.Format.Opaque);
     SetEGLConfigChooser(8, 8, 8, 8, 16, 0);
     _previewer = new VideoPreviewer(_context, this);
     SetRenderer(_previewer);
     RenderMode = Rendermode.WhenDirty;
 }
 void Update()
 {
     if (objectThread.BUnityWorkMutex)
     {
         lock (objectThread) {
             objectThread.BUnityWorkMutex = false;
             VideoPreviewer.Instance().StartPreview(objectThread.UnityFullpath, PreViewDone);
         }
     }
 }
Ejemplo n.º 6
0
        private void Dialog_VideoDownloadComplete(object sender, EventArgs e)
        {
            //show video previewer

            using (VideoPreviewer vidPreviewer = new VideoPreviewer(Enums.Actions.Video, Path.Combine(Constants.VideoCacheLocation, "temp_facebook_vid.mp4")))
            {
                vidPreviewer.ShowDialog();
            }

            ImageDiskCache.RemoveSpecificItemFromCache(Path.Combine(Constants.VideoCacheLocation, "temp_facebook_vid.mp4"));
        }
Ejemplo n.º 7
0
 private void Vd_VideoDownloadComplete(object sender, EventArgs e)
 {
     Invoke((Action) delegate
     {
         using (VideoPreviewer vidPreviewer = new VideoPreviewer(Actions.Video, Path.Combine(Constants.VideoCacheLocation, "temp_video_download.mp4")))
         {
             vidPreviewer.ShowDialog();
         }
         ImageDiskCache.RemoveSpecificItemFromCache(Path.Combine(Constants.VideoCacheLocation, "temp_video_download.mp4"));
     });
 }
 // Update is called once per frame
 void Update()
 {
     if (fileDialog.objectThread.BUnityWorkMutex)
     {
         lock (fileDialog.objectThread) {
             fileDialog.objectThread.BUnityWorkMutex = false;
             VideoPreviewer.Instance().StartPreview(fileDialog.objectThread.UnityFullpath, fileDialog.PreViewDone);
             fileDialog.merialDlg.Hide();
         }
     }
 }
Ejemplo n.º 9
0
        private void osirtVideoCapture_VideoCaptureComplete(object sender, EventArgs e)
        {
            if (markerWindow != null && markerWindow.Visible)
            {
                markerWindow.Close();
                markerWindow.Dispose();
            }

            using (VideoPreviewer vidPreviewer = new VideoPreviewer(Enums.Actions.Video))
            {
                vidPreviewer.ShowDialog();
            }

            ImageDiskCache.RemoveSpecificItemFromCache(Constants.TempVideoFile);
        }
    IEnumerator CoroutineSelect()
    {
        OpenFileName ofn = new OpenFileName();

        ofn.structSize = Marshal.SizeOf(ofn);

        //三菱(*.gxw)\0*.gxw\0西门子(*.mwp)\0*.mwp\0All Files\0*.*\0\0
        ofn.filter = "All Files\0*.mp4;*.mpg\0\0";

        ofn.file = new string(new char[256]);

        ofn.maxFile = ofn.file.Length;

        ofn.fileTitle = new string(new char[64]);

        ofn.maxFileTitle = ofn.fileTitle.Length;

        ofn.initialDir = UnityEngine.Application.dataPath;       //默认路径

        ofn.title = "Open Picture";

        ofn.defExt = "mp4";                                                         //显示文件的类型
        //注意 一下项目不一定要全选 但是0x00000008项不要缺少
        ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR


        if (DllComdlg.GetOpenFileName(ofn))
        {
            // StartCoroutine(WaitLoad(ofn.file));//加载图片到panle
            string filename = "file:///" + Utility.StrictLinuxStyle(ofn.file);
            Debug.Log("Selected file with full path========: " + filename);
            ofn.file = filename;

            FileItem item = new FileItem();
            item._fileInfo = new OpenFileNameEx(ofn);
            item._fileType = FileItem.FileType.FileType_Video;
            //FileListControl.Instance ().AddFile (item);

            //file path must convert for url path...
            //VideoPreviewer.Instance().StartPreview  ("file:///C:/Unity3d/dangmu/dangmu/Assets/Dangmu/Textures/WeChat_20180305193437.mp4", PreViewDone);

            lock (VideoPreviewer.Instance()) {
                VideoPreviewer.Instance().StartPreview(filename, PreViewDone);
            }
            //StartCoroutine ( WaitLoadTexture(ofn.file) );
        }
        yield return(0);
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     //TestLoadPicture ();
     VideoPreviewer.Instance().StartPreview("file:///C:/Unity3d/dangmu/dangmu/Assets/Dangmu/Textures/WeChat_20180305193437.mp4", PreViewDone);
     //VideoPreviewer.Instance().StartPreview ("file://C:\\Unity3d\\dangmu\\dangmu\\Assets\\Dangmu\\Textures\\WeChat_20180305193437.mp4", PreViewDone);
 }
Ejemplo n.º 12
0
        private void osirtVideoCapture_VideoCaptureComplete(object sender, EventArgs e)
        {
            if (markerWindow != null && markerWindow.Visible)
            {
                markerWindow.Close();
                markerWindow.Dispose();
            }

            uiTabbedBrowserControl.CurrentTab.Browser.MouseTrailVisible = false;
            //VideoCaptureCompleteEventArgs ev = (VideoCaptureCompleteEventArgs)e;

            using (VideoPreviewer vidPreviewer = new VideoPreviewer(Enums.Actions.Video))
            {
                vidPreviewer.ShowDialog();
            }

            ImageDiskCache.RemoveSpecificItemFromCache(Constants.TempVideoFile);
        }
        private void CurrentBrowser_YouTubeDownloadComplete(object sender, EventArgs e)
        {
            Invoke((MethodInvoker)delegate
            {
                uiDownloadProgressBar.Visible = false;
                DialogResult dialogRes;
                string fileName;
                string dateAndtime;

                using (VideoPreviewer vidPreviewer = new VideoPreviewer(Enums.Actions.Video))
                {
                    dialogRes = vidPreviewer.ShowDialog();
                    fileName = vidPreviewer.FileName + vidPreviewer.FileExtension; ;
                    dateAndtime = vidPreviewer.DateAndTime;
                }

                if (dialogRes != DialogResult.OK)
                    return;

                DisplaySavedLabel(fileName, dateAndtime);
                ImageDiskCache.RemoveSpecificItemFromCache(Constants.TempVideoFile);

            });
        }