Wondering about how some videos were made?

Getting videos with Ziggeo is quite simple and easy to do. So much simple that you might not have thought about the many different ways this could happen.

To be more precise you could get your media captured in the following ways:

  1. Screen recording through the use of browser
  2. Camera recording through the browser
  3. Uploading and capturing from mobile apps

Now the 3rd one captures several things. This is because when you capture the video through mobile app, you are always getting file uploads. So technically we are always getting uploads in such case.

Today we will show you how to do this with a bit of code. Python code to be precise.

While that is the case, the code is quite similar for any other language that you might use to talk with our system through our API.

The code

The most important call we will do is to our index() API endpoint. For videos this would look like so:

video_list = ziggeo.videos().index({"limit":100, "skip":skip})

This will give us 100 videos, so we just make it go through all videos 100 at a time. Remember that 50 is default and 100 is the maximum number for our API.

Now, you can do any number of checks that you like. For this specific case we will want to focus only on the device_info parameter.

Within the device info parameter we will be looking at the media_source parameter and that will tell us exactly what we are after.

The following would be the Python code you would use:

def indexVideos(skip=0):
	global webrtc_screen_recordings, webrtc_camera_recordings, file_uploads_or_camera_app

	video_list = ziggeo.videos().index({"limit":100, "skip":skip})

	for video in video_list:
		if video['device_info'] is not None:
			media_source_value = video['device_info']['media_source']
			if media_source_value == 'screen':
				webrtc_screen_recordings +=1
			elif media_source_value == 'record':
				webrtc_camera_recordings +=1
			elif media_source_value == "upload":
				file_uploads_or_camera_app +=1
        
	if(len(video_list) > 0):
		indexVideos(skip+100)
	pass


indexVideos(0)

As we mentioned above, there are many other things you can get at the same time. You can check out our demos directory to see more examples and find what you might be interested in. You can see them here: https://github.com/Ziggeo/ZiggeoPythonSdk/tree/master/demos

Want to see some other examples? Let us know what you are interested in and your language preference and we might just add it to our blog. You can do so by reaching out to our friendly support team by sending email to support@ziggeo.com.

If you are interested in full demo of this code, check out this demo.

PREV NEXT