public VideoPage()
        {
            this.InitializeComponent();

            mediaElement.AutoPlay = true;
            SetMovieSource();

            var cmp = new CommentPresenter();

            cmp.Load("test.nicocomment");

            var canvast = new CanvasTarget(canvas)
            {
                Fps = textBlockFps
            };
            var videot = new VideoTarget(mediaElement);

            _timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(1.0 / 30)
            };
            _timer.Tick += (f, e) =>
            {
                cmp.Draw(canvast, videot);
            };
            _timer.Start();
        }
Example #2
0
        public unsafe void LoadFilePathWithCString(byte *s, int vposShift, int startPos, int endPos)
        {
            //何かセットしとかないと読み込めなかったとき落ちる
            cmp.Comments = new Comment[0];

            filePath = System.Runtime.InteropServices.Marshal.PtrToStringAnsi((System.IntPtr)s);
            if (File.Exists(filePath))
            {
                try
                {
                    cmp.Load(filePath, vposShift, startPos, endPos);
                    if (cmp.Comments.Length == 0)
                    {
                        ErrorStr = "No comments found in file";
                    }
                    else
                    {
                        ErrorStr = "";
                    }
                }
                catch (Exception e)
                {
                    ErrorStr = "Couldn't load comment file:" + Environment.NewLine + e.Message;
                }
            }
            else
            {
                ErrorStr = "Comment file not found";
            }
        }