﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AnjoChat.Code.P2P;

namespace AnjoChat.Code.Media.Video
{
    public class VideoDataHandler : IDataHandler
    {
        public event EventHandler UpdatedImage = delegate { };

        public DataChannel Channel
        {
            get { return DataChannel.ScreenShare; }
        }

        public byte[] ImageBytes { get; private set; }

        public void DataReceived(DataReceivedArgs e)
        {
            //Console.WriteLine("Image: " + e.Data.Length);
            //File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/img.jpg", e.Data);

            ImageBytes = e.Data;
            Task.Run(() => UpdatedImage(this, EventArgs.Empty));
        }
    }
}
