Exemple #1
0
 public VideoManageUseCase(AppSettings appSettings, IStorageRepository storageRepository, IVideoIndexerClient videoIndexerClient)
 {
     AppSettings        = appSettings;
     StorageRepository  = storageRepository;
     VideoIndexerClient = videoIndexerClient;
     Videos             = new ReadOnlyObservableCollection <Result>(_videos = new ObservableCollection <Result>());
 }
        public MediaPage(IVideoIndexerClient client)
        {
            this.client = client;
            InitializeComponent();

            takeVideo.Clicked += async(sender, args) =>
            {
                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakeVideoSupported)
                {
                    DisplayAlert("No Camera", ":( No camera avaialble.", "OK");
                    return;
                }

                var file = await CrossMedia.Current.TakeVideoAsync(new StoreVideoOptions
                {
                    Quality       = VideoQuality.Low,
                    DesiredLength = TimeSpan.FromHours(1d).Subtract(TimeSpan.FromSeconds(1d)),
                    DefaultCamera = CameraDevice.Rear,
                    Name          = $"{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}-{DateTime.Now.Hour}-{DateTime.Now.Minute}-{DateTime.Now.Second}.mp4",
                    Directory     = "DefaultVideos",
                });

                if (file == null)
                {
                    return;
                }

                var path = file.Path;
                file.Dispose();

                await client.UploadAsync(path, apiKey.Text, storageCS.Text, viAccountName.Text, status => { statusLable.Text = status; });
            };

            pickVideo.Clicked += async(sender, args) =>
            {
                if (!CrossMedia.Current.IsPickVideoSupported)
                {
                    DisplayAlert("Videos Not Supported", ":( Permission not granted to videos.", "OK");
                    return;
                }
                var file = await CrossMedia.Current.PickVideoAsync();

                if (file == null)
                {
                    return;
                }

                var path = file.Path;
                file.Dispose();

                await client.UploadAsync(path, apiKey.Text, storageCS.Text, viAccountName.Text, status => { statusLable.Text = status; });
            };
        }
 public App(IVideoIndexerClient client)
 {
     // The root page of your application
     MainPage = new MediaPage(client);
 }
Exemple #4
0
 public VideoIndexer(IVideoIndexerBlobClient videoIndexerBlobClient, IVideoIndexerClient videoIndexerClient)
 {
     this._videoIndexerBlobClient = videoIndexerBlobClient;
     this._videoIndexerClient     = videoIndexerClient;
 }
 public VideoIndexingCallback(IVideoIndexerClient videoIndexerClient)
 {
     _videoIndexerClient = videoIndexerClient;
 }