#Solution :
There are two appium native methods used for recording video on iOS platform irrespective of whether we are recording on simulator or real device?
- context.driver.start_recording_screen()
- context.driver.stop_recording_screen()
#Start - Video recording
context.driver.start_recording_screen(videoType='h264', videoQuality='high')
#Stop - Recording
video_file_name = f'{time.strftime("%Y%m%d_%H%M%S")}_{context.feature.name}_{context.scenario.name}.mp4'
video_file_path = os.path.join(video_recording_directory, video_file_name)
raw_video_data = context.driver.stop_recording_screen()
This raw data needs to be decoded from base64 inorder to create and save video file
with open(video_file_path, "wb") as fd:
fd.write(base64.b64decode(raw_video_data))
log.info(f'{video_file_path} saved')