Gets a value that indicates whether closed captioning is enabled.
public virtual bool ClosedCaptioning { get; set; } Public Overridable Property ClosedCaptioning As Boolean
true if Closed Captioning is enabled; false, otherwise.
Closed captioning is the text transcription of audio overlaid on the video frame. Assignment can raise an error exception. For more information, refer to the Error Codes.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public CaptureCtrl _capturectrl;public void ClosedCaptioningExample(){// reference the capture control_capturectrl = _form.CaptureCtrl;// output file namesstring outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_ClosedCaptioningExample_DVD");try{// try to find a Digital tuner, use your device name hereif (_capturectrl.VideoDevices["Analog"] == null)throw new Exception("No Analog video device available");_capturectrl.VideoDevices["Analog"].Selected = true;// select video and audio compressors_capturectrl.VideoCompressors.Mpeg2.Selected = true;_capturectrl.AudioCompressors.AC3.Selected = true;// set the target format to MPEG2 program_capturectrl.TargetFormat = TargetFormatType.MPEG2Program;if (_capturectrl.HasDialog(CaptureDlg.TargetFormat))_capturectrl.ShowDialog(CaptureDlg.TargetFormat, _form);// tune to a channel with closed captions_capturectrl.TVTuner.SetChannel(28, -1, -1);// set the target file_capturectrl.TargetFile = outFile;// enable the preview_capturectrl.Preview = true;// check whether closed captioning is enabledif (_capturectrl.ClosedCaptionAvailable&& _capturectrl.ClosedCaptioning == false){// try to toggle closed captioning_capturectrl.ToggleClosedCaptioning();// set the result to what we expectif (_capturectrl.ClosedCaptioning)_result = true;// get the previewing cc statebool _previewCC = _capturectrl.PreviewingClosedCaption;}// check whether we can capture videoif (_capturectrl.IsModeAvailable(CaptureMode.VideoAndAudio)){_capturectrl.TimeLimit = 30; // just 30 seconds of capture time_capturectrl.UseTimeLimit = true;// start the capture process_capturectrl.StartCapture(CaptureMode.VideoAndAudio);// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (_capturectrl.State == CaptureState.Running)Application.DoEvents();_result = true;}}catch (Exception){_result = false;}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (_capturectrl.State == CaptureState.Running)Application.DoEvents();}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public _capturectrl As CaptureCtrlPublic Sub ClosedCaptioningExample()' reference the capture control_capturectrl = _form.CaptureCtrl' output file namesDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_ClosedCaptioningExample_DVD")Try' try to find a Digital tuner, use your device name hereIf _capturectrl.VideoDevices("Analog") Is Nothing ThenThrow New Exception("No Analog video device available")End If_capturectrl.VideoDevices("Analog").Selected = True' select video and audio compressors_capturectrl.VideoCompressors.Mpeg2.Selected = True_capturectrl.AudioCompressors.AC3.Selected = True' set the target format to MPEG2 program_capturectrl.TargetFormat = TargetFormatType.MPEG2ProgramIf _capturectrl.HasDialog(CaptureDlg.TargetFormat) Then_capturectrl.ShowDialog(CaptureDlg.TargetFormat, _form)End If' tune to a channel with closed captions_capturectrl.TVTuner.SetChannel(28, -1, -1)' set the target file_capturectrl.TargetFile = outFile' enable the preview_capturectrl.Preview = True' check if closed captioning is enabledIf _capturectrl.ClosedCaptionAvailable AndAlso _capturectrl.ClosedCaptioning = False Then' try to toggle closed captioning_capturectrl.ToggleClosedCaptioning()' set the result to what we expectIf _capturectrl.ClosedCaptioning Then_result = TrueEnd If' get the previewing cc stateDim _previewCC As Boolean = _capturectrl.PreviewingClosedCaptionEnd If' check if we have can capture videoIf _capturectrl.IsModeAvailable(CaptureMode.VideoAndAudio) Then_capturectrl.TimeLimit = 30 ' just 30 seconds of capture time_capturectrl.UseTimeLimit = True' start the capture process_capturectrl.StartCapture(CaptureMode.VideoAndAudio)' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While _capturectrl.State = CaptureState.RunningApplication.DoEvents()Loop_result = TrueEnd IfCatch e1 As Exception_result = FalseEnd Try' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While _capturectrl.State = CaptureState.RunningApplication.DoEvents()LoopEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
