@@ -28,24 +28,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2828
2929 println ! ( "=== Recording Output Example (macOS 15.0+) ===\n " ) ;
3030
31- // Create output configuration
32- let mut config = SCRecordingOutputConfiguration :: new ( ) ;
33-
34- // Set output file path
31+ // Create output configuration using builder pattern
3532 let output_path = PathBuf :: from ( "/tmp/screen_recording.mp4" ) ;
36- config. set_output_url ( & output_path) ;
37- println ! ( "📁 Output path: {}" , output_path. display( ) ) ;
38-
39- // Set video codec (H.264 or HEVC)
40- config. set_video_codec ( SCRecordingOutputCodec :: H264 ) ;
41- println ! ( "🎬 Video codec: {:?}" , config. get_video_codec( ) ) ;
33+ let config = SCRecordingOutputConfiguration :: new ( )
34+ . with_output_url ( & output_path)
35+ . with_video_codec ( SCRecordingOutputCodec :: H264 )
36+ . with_output_file_type ( SCRecordingOutputFileType :: MP4 )
37+ . with_average_bitrate ( 10_000_000 ) ;
4238
43- // Set output file type (MP4 or MOV)
44- config. set_output_file_type ( SCRecordingOutputFileType :: MP4 ) ;
45- println ! ( "📄 File type: {:?}" , config. get_output_file_type( ) ) ;
46-
47- // Set bitrate (10 Mbps)
48- config. set_average_bitrate ( 10_000_000 ) ;
39+ println ! ( "📁 Output path: {}" , output_path. display( ) ) ;
40+ println ! ( "🎬 Video codec: {:?}" , config. video_codec( ) ) ;
41+ println ! ( "📄 File type: {:?}" , config. output_file_type( ) ) ;
4942 println ! ( "📊 Bitrate: 10 Mbps" ) ;
5043
5144 // Query available options
@@ -99,11 +92,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
9992
10093 // Test with HEVC and MOV
10194 println ! ( "\n 🔄 Testing HEVC + MOV configuration..." ) ;
102- let mut hevc_config = SCRecordingOutputConfiguration :: new ( ) ;
103- hevc_config . set_video_codec ( SCRecordingOutputCodec :: HEVC ) ;
104- hevc_config . set_output_file_type ( SCRecordingOutputFileType :: MOV ) ;
105- println ! ( " Codec: {:?}" , hevc_config. get_video_codec ( ) ) ;
106- println ! ( " File type: {:?}" , hevc_config. get_output_file_type ( ) ) ;
95+ let hevc_config = SCRecordingOutputConfiguration :: new ( )
96+ . with_video_codec ( SCRecordingOutputCodec :: HEVC )
97+ . with_output_file_type ( SCRecordingOutputFileType :: MOV ) ;
98+ println ! ( " Codec: {:?}" , hevc_config. video_codec ( ) ) ;
99+ println ! ( " File type: {:?}" , hevc_config. output_file_type ( ) ) ;
107100
108101 println ! ( "\n ✅ Recording output example completed!" ) ;
109102 Ok ( ( ) )
0 commit comments