DigitalFormEmbeddedVideo.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Threading.Tasks;
  2. using InABox.Core;
  3. using InABox.Mobile;
  4. namespace PRS.Mobile
  5. {
  6. public class DigitalFormEmbeddedVideo : DigitalFormEmbeddedMedia<DFLayoutVideoField, DFLayoutVideoFieldProperties, byte[]>
  7. {
  8. protected override bool IsVideo => true;
  9. protected override bool DisableLibrary => Definition.Properties.DisableLibrary;
  10. protected override bool Secure => Definition.Properties.Secure;
  11. protected override bool Required => Definition.Properties.Required;
  12. protected override Task<MobileDocument> CaptureMedia()
  13. {
  14. return MobileDocument.From<MobileDocumentVideoSource>(
  15. new MobileDocumentVideoOptions()
  16. );
  17. }
  18. protected override Task<MobileDocument> SelectMedia()
  19. {
  20. return MobileDocument.From<MobileDocumentVideoLibrarySource>(
  21. new MobileDocumentVideoLibraryOptions()
  22. );
  23. }
  24. protected override byte[] GetValue() => _value.Thumbnail;
  25. protected override void SetValue(byte[] value) => _value.Thumbnail = value;
  26. protected override byte[] CreateThumbnail(byte[] data, int maxwidth = 256, int maxheight=256)
  27. {
  28. return MobileUtils.ImageTools.CreateVideoThumbnail(data, maxwidth, maxheight);
  29. }
  30. }
  31. }