Jump to content

Search the Community

Showing results for tags 'tvideocapturedevice'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. Hi, I am following this example for setting up a VideoCaptureDevice app: https://docwiki.embarcadero.com/RADStudio/Sydney/en/Video_Capturing I could not get the VideoCaptureDevice to start. I tried 4 known good cameras and get the same thing, I modified the code a bit to give me an indicator that I am indeed setting up the app right, still nothing. The app compiles just fine, just won't start capture. My version of Delphi is 10.2.3 and the following is my current code: unit FMXCamera_Main; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects, FMX.ListBox, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Layouts, FMX.Media, FMX.Edit; type TForm1 = class(TForm) Layout1: TLayout; btnStart: TButton; ComboBox1: TComboBox; Image1: TImage; procedure FormCreate(Sender: TObject); procedure ComboBox1Change(Sender: TObject); procedure btnStartClick(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } VideoCamera: TVideoCaptureDevice; procedure SampleBufferSync; procedure SampleBufferReady(Sender: TObject; const ATime: TMediaTime); end; var Form1: TForm1; implementation // Delphi version of the implementation {$R *.fmx} procedure TForm1.btnStartClick(Sender: TObject); begin if(VideoCamera <> nil) then begin if(VideoCamera.State = TCaptureDeviceState.Stopped) then begin VideoCamera.OnSampleBufferReady := SampleBufferReady; VideoCamera.CaptureSettingPriority := TVideoCaptureSettingPriority.FrameRate; VideoCamera.StartCapture; if(VideoCamera.State = TCaptureDeviceState.Capturing) then begin btnStart.Text := 'Stop'; end else begin VideoCamera.StopCapture; btnStart.Text := 'Start'; end; end else begin VideoCamera.StopCapture; btnStart.Text := 'Start'; end; end else begin Caption := 'Video capture devices not available.'; end; end; procedure TForm1.ComboBox1Change(Sender: TObject); begin VideoCamera := TVideoCaptureDevice(TCaptureDeviceManager.Current.GetDevicesByName(ComboBox1.Selected.Text)); if (VideoCamera <> nil) then begin btnstart.Text := 'Start '+VideoCamera.Name; btnStart.Enabled := true; end; end; procedure TForm1.FormCreate(Sender: TObject); var DeviceList: TCaptureDeviceList; i: integer; begin DeviceList := TCaptureDeviceManager.Current.GetDevicesByMediaType(TMediaType.Video); for i := 0 to DeviceList.Count - 1 do begin ComboBox1.Items.Add(DeviceList[i].Name); end; end; procedure TForm1.FormDestroy(Sender: TObject); begin if(VideoCamera <> nil) then begin VideoCamera.StopCapture; end; end; procedure TForm1.SampleBufferReady(Sender: TObject; const ATime: TMediaTime); begin TThread.Synchronize(TThread.CurrentThread, SampleBufferSync); //Resize the image so that the video is buffered in its original size Image1.Width := Image1.Bitmap.Width; Image1.Height := Image1.Bitmap.Height; end; procedure TForm1.SampleBufferSync; begin VideoCamera.SampleBufferToBitmap(Image1.Bitmap, true); end; end.
×