@@ -559,6 +559,11 @@ internal static extern int LibVLCMediaPlayerAddSlave(IntPtr mediaPlayer, MediaSl
559
559
internal static extern bool LibVLCVideoSetOutputCallbacks ( IntPtr mediaplayer , VideoEngine engine , OutputSetup ? outputSetup ,
560
560
OutputCleanup ? outputCleanup , OutputSetResize ? resize , UpdateOutput updateOutput , Swap swap , MakeCurrent makeCurrent ,
561
561
GetProcAddress ? getProcAddress , FrameMetadata ? metadata , OutputSelectPlane ? selectPlane , IntPtr opaque ) ;
562
+
563
+ [ DllImport ( Constants . LibraryName , CallingConvention = CallingConvention . Cdecl ,
564
+ EntryPoint = "libvlc_media_player_record" ) ]
565
+ internal static extern void LibVLCMediaPlayerRecord ( IntPtr mediaplayer , bool enable , IntPtr path ) ;
566
+
562
567
#if ANDROID
563
568
[ DllImport ( Constants . LibraryName , CallingConvention = CallingConvention . Cdecl ,
564
569
EntryPoint = "libvlc_media_player_set_android_context" ) ]
@@ -2067,6 +2072,27 @@ public bool SetOutputCallbacks(VideoEngine engine, OutputSetup? outputSetup, Out
2067
2072
FrameMetadata ? _frameMetadata ;
2068
2073
OutputSelectPlane ? _outputSelectPlane ;
2069
2074
2075
+ /// <summary>
2076
+ /// Start recording
2077
+ /// <para/>
2078
+ /// Users should subscribe to <see cref="MediaPlayer.RecordChanged"/> beforehand to get the final filepath of the recorded file and
2079
+ /// monitor the recording state.
2080
+ /// <para/>
2081
+ /// LibVLC 4.0 and later
2082
+ /// </summary>
2083
+ /// <param name="directory">path of the recording directory or NULL (use default path)</param>
2084
+ public void StartRecording ( string ? directory = null ) => Native . LibVLCMediaPlayerRecord ( NativeReference , enable : true , directory . ToUtf8 ( ) ) ;
2085
+
2086
+ /// <summary>
2087
+ /// Stop recording
2088
+ /// <para/>
2089
+ /// Users should subscribe to <see cref="MediaPlayer.RecordChanged"/> beforehand to get the final filepath of the recorded file and
2090
+ /// monitor the recording state.
2091
+ /// <para/>
2092
+ /// LibVLC 4.0 and later
2093
+ /// </summary>
2094
+ public void StopRecording ( ) => Native . LibVLCMediaPlayerRecord ( NativeReference , enable : false , IntPtr . Zero ) ;
2095
+
2070
2096
readonly MediaConfiguration Configuration = new MediaConfiguration ( ) ;
2071
2097
2072
2098
#if UNITY
@@ -3003,6 +3029,15 @@ public event EventHandler<MediaPlayerProgramSelectedEventArgs> ProgramSelected
3003
3029
add => EventManager . AttachEvent ( EventType . MediaPlayerProgramSelected , value ) ;
3004
3030
remove => EventManager . DetachEvent ( EventType . MediaPlayerProgramSelected , value ) ;
3005
3031
}
3032
+
3033
+ /// <summary>
3034
+ /// The recording state of the mediaplayer changed
3035
+ /// </summary>
3036
+ public event EventHandler < MediaPlayerRecordChangedEventArgs > RecordChanged
3037
+ {
3038
+ add => EventManager . AttachEvent ( EventType . MediaPlayerRecordChanged , value ) ;
3039
+ remove => EventManager . DetachEvent ( EventType . MediaPlayerRecordChanged , value ) ;
3040
+ }
3006
3041
#endregion
3007
3042
3008
3043
/// <summary>
0 commit comments