public BaseMediaContentUploadingService(
     IMediaContentService contents,
     ICloudStorage storage)
 {
     this.contents = contents;
     this.storage = storage;
 }
        public PlaylistViewModel(INavigation navigation = null, Action postAction = null) : base(navigation)
        {
            _mediaContentService = DependencyService.Get <IMediaContentService>();
            helper                   = DependencyService.Get <IHelper>();
            MediaContents            = new List <mediaFile.MediaContentDetail>();
            AccordionSources         = new List <AccordionExtendedSource>();
            BindDataSourceAction     = postAction;
            MessageText              = string.Empty;
            MessageVisible           = false;
            IsPlaying                = false;
            ButtonSelectedPreviously = ButtonSelected.None;

            CrossMediaManager.Current.MediaFileChanged +=
                (object sender, Plugin.MediaManager.Abstractions.EventArguments.MediaFileChangedEventArgs e) =>
            {
                if (IsPlaying)
                {
                    ClosePopupAction();
                }
                else
                {
                    IsPlaying = true;
                }
            };
        }
        // Subscribe to get notified when some events occur.
        // 1. When a new voice memo is saved in an internal storage
        // 2. When a voice memo is deleted from an internal storage
        // 3. When it's checked whether user consent is obtained
        void RegisterForImportantEvents()
        {
            // You can get notified whenever a new voice memo record is created.
            // At this point of time, information(record) about that voice memo is needed to store
            MessagingCenter.Subscribe <RecordingPageModel, Record>(this, MessageKeys.SaveVoiceMemo, (obj, item) =>
            {
                // Add it to the collection of records
                var record = ((LatestRecord)item).Record;
                Records.Add(record);
            });

            // You can get notified whenever translated text via speech-to-text service is ready
            // Now, we can update Record to database
            MessagingCenter.Subscribe <RecordingPageModel, Record>(this, MessageKeys.SaveVoiceMemoInDB, async(obj, record) =>
            {
                // add it to database
                await App.Database.SaveItemAsync(record);
            });

            // You can get notified whenever a voice memo record is deleted from a storage
            MessagingCenter.Subscribe <Page, Record>(this, MessageKeys.DeleteVoiceMemo, async(obj, item) =>
            {
                var record = item as Record;
                for (int i = Records.Count - 1; i >= 0; i--)
                {
                    if (Records[i]._id == record._id)
                    {
                        // Delete record from database
                        await App.Database.DeleteItemAsync(Records[i]);
                        // Delete audio file from internal storage
                        _ContentService.RemoveMediaFile(Records[i].Path);
                        // Delete it from collection of records
                        Records.RemoveAt(i);
                    }
                }
            });

            // You can get notified when an app user allows this app to use recorder and internal storage.
            MessagingCenter.Subscribe <App, bool>(this, MessageKeys.UserPermission, (obj, item) =>
            {
                var NonUItask = Task.Run(async() =>
                {
                    //await Task.Delay(3000);
                    // Restore recorded voice memos
                    List <Record> tmp = await App.Database.GetItemsAsync();
                    for (int i = 0; i < tmp.Count; i++)
                    {
                        Records.Add(tmp[i]);
                    }
                    // Speech-To-Text Service
                    GetSttService();

                    // Media Content Service
                    if (_ContentService == null)
                    {
                        _ContentService = DependencyService.Get <IMediaContentService>(DependencyFetchTarget.GlobalInstance);
                    }
                });
            });
        }
示例#4
0
 public TrainingVideoViewModel(INavigation navigation = null) : base(navigation)
 {
     this._mediaContentService = DependencyService.Get <IMediaContentService>();
     this.MediaContents        = new List <MediaContentDetail>();
     this.ButtonPlayStop       = TextResources.Play;
     this.ButtonNext           = TextResources.Next;
     this.ButtonPrevious       = TextResources.Previous;
 }
 public ModeratorMediaContentController(
     IMediaContentService contentService,
     IMediaCategoryService categoryService,
     IMediaCollectionService collectionService)
 {
     this.contentService = contentService;
     this.categoryService = categoryService;
     this.collectionService = collectionService;
 }
示例#6
0
 public MediaController(IContextWrapper contextWrapper, IMediaContentService mediaContentService, IGlassHtml glassHtml)
 {
     _contextWrapper      = contextWrapper;
     _mediaContentService = mediaContentService;
     _glassHtml           = glassHtml;
 }
 public BaseFetcherService(IMediaContentService contentService)
 {
     this.contentService = contentService;
     this.type = this.GetContentType();
 }
 public VideoFetcherService(IMediaContentService contentService)
     : base(contentService)
 {
 }
 public MusicUploadingService(
     IMediaContentService contents,
     ICloudStorage storage)
     : base(contents, storage)
 {
 }
 public MediaContentFetcherService(IMediaContentService contents)
 {
     this.contents = contents;
 }
 public PictureFetcherService(IMediaContentService contentService)
     : base(contentService)
 {
 }
 public MyMediaController(IContextWrapper contextWrapper, IMediaContentService mediaContentService)
 {
     _contextWrapper      = contextWrapper;
     _mediaContentService = mediaContentService;
 }
 public MusicFetcherService(IMediaContentService contentService)
     : base(contentService)
 {
 }