{"id":10328,"date":"2025-11-22T11:35:42","date_gmt":"2025-11-22T17:35:42","guid":{"rendered":"https:\/\/infiniteuploads.com\/?post_type=docs&#038;p=10328"},"modified":"2025-12-01T16:44:23","modified_gmt":"2025-12-01T22:44:23","password":"","slug":"fetching-videos-with-infinite_uploads_get_videos","status":"publish","type":"docs","link":"https:\/\/infiniteuploads.com\/docs\/developers\/fetching-videos-with-infinite_uploads_get_videos\/","title":{"rendered":"Fetching Videos with infinite_uploads_get_videos()"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p>This article provides technical documentation for developers who want to integrate with the <strong>Infinite Uploads Video Library<\/strong> using the PHP helper function <code>infinite_uploads_get_videos()<\/code>.<\/p>\n\n\n\n<p>Use this function to retrieve cloud-hosted video objects and incorporate them into your plugin, theme, or custom workflow.<\/p>\n\n\n\n<p><code>infinite_uploads_get_videos()<\/code> retrieves video records from the Infinite Uploads cloud library.<br>It supports pagination, searching, and ordering of results.<\/p>\n\n\n\n<p>This allows developers to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Display video lists or galleries<\/li>\n\n\n\n<li>Fetch and embed videos<\/li>\n\n\n\n<li>Build custom UI pickers for selecting videos<\/li>\n\n\n\n<li>Integrate Infinite Uploads video data into plugins or extensions<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"function-name\">Function Name<\/h2>\n\n\n\n<p><code>infinite_uploads_get_videos<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"parameters\">Parameters<\/h2>\n\n\n\n<p><code>$params<\/code> <em>(array, optional)<\/em> &mdash; An associative array controlling which videos are returned.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Parameter<\/th><th>Type<\/th><th>Default<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>page<\/code><\/td><td>int<\/td><td><code>1<\/code><\/td><td>Page number to fetch<\/td><\/tr><tr><td><em><code>per_page<\/code><\/em><\/td><td>int<\/td><td><code>40<\/code><\/td><td>Number of results per page<\/td><\/tr><tr><td><em><code>order_by<\/code><\/em><\/td><td>string<\/td><td><code>'dateCreated'<\/code><\/td><td>Field to sort results by<\/td><\/tr><tr><td><code>search<\/code><\/td><td>string<\/td><td><code>''<\/code><\/td><td>Search term applied to video title\/description<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Important:<\/strong> The API does <em>not<\/em> support filtering by <code>video_id<\/code>. It always returns videos stored in the site's existing Infinite Uploads library.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"return-value\">Return Value<\/h2>\n\n\n\n<p>The function returns an associative array matching the Infinite Uploads API response.<\/p>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-e294cb5a\" id=\"betterdocs-code-snippet-e294cb5a\" data-language=\"javascript\" data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">&#128196;<\/span>\n                                            <\/div>\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\" type=\"button\" data-clipboard-target=\"#betterdocs-code-snippet-e294cb5a .betterdocs-code-snippet-code code\" aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"><\/path>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>[\n    'success' =&gt; true,\n    'data'    =&gt; [\n        'totalItems'   =&gt; int,\n        'currentPage'  =&gt; int,\n        'itemsPerPage' =&gt; int,\n        'items'        =&gt; [ ... array of videos ... ]\n    ]\n]<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-e294cb5a');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<p>If the request fails, the function may throw an <code>Exception<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"video-object-fields\">Video Object Fields<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Property<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>videoLibraryId<\/code><\/td><td>Unique video ID<\/td><\/tr><tr><td><code>guid<\/code><\/td><td>Internal unique identifier<\/td><\/tr><tr><td><code>title<\/code><\/td><td>Video title<\/td><\/tr><tr><td><code>description<\/code><\/td><td>Description text (may be null)<\/td><\/tr><tr><td><code>dateUploaded<\/code><\/td><td>Upload timestamp<\/td><\/tr><tr><td><code>views<\/code><\/td><td>Total view count<\/td><\/tr><tr><td><code>isPublic<\/code><\/td><td>Whether the video is public<\/td><\/tr><tr><td><code>length<\/code><\/td><td>Duration in seconds<\/td><\/tr><tr><td><code>status<\/code><\/td><td>Processing\/encoding status<\/td><\/tr><tr><td><code>framerate<\/code><\/td><td>Framerate value<\/td><\/tr><tr><td><code>width<\/code> \/ <code>height<\/code><\/td><td>Video dimensions<\/td><\/tr><tr><td><code>availableResolutions<\/code><\/td><td>Comma-separated list of resolutions<\/td><\/tr><tr><td><code>thumbnailFileName<\/code><\/td><td>Thumbnail filename<\/td><\/tr><tr><td><code>thumbnailBlurhash<\/code><\/td><td>Blurhash string<\/td><\/tr><tr><td><code>encodeProgress<\/code><\/td><td>Encoding progress (0&ndash;100%)<\/td><\/tr><tr><td><code>storageSize<\/code><\/td><td>File size in bytes<\/td><\/tr><tr><td><code>captions<\/code><\/td><td>Array of caption tracks<\/td><\/tr><tr><td><code>category<\/code><\/td><td>Category string<\/td><\/tr><tr><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Note:<\/strong><br>There is no <code>url<\/code> or <code>thumbnail_url<\/code> returned at this API layer.<br>Your integration may need to generate or request those separately.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"example-api-response\">Example API Response<\/h2>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-d2369a04\" id=\"betterdocs-code-snippet-d2369a04\" data-language=\"javascript\" data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">&#128196;<\/span>\n                                            <\/div>\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\" type=\"button\" data-clipboard-target=\"#betterdocs-code-snippet-d2369a04 .betterdocs-code-snippet-code code\" aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"><\/path>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>{\n    \"success\": true,\n    \"data\": {\n        \"totalItems\": 1,\n        \"currentPage\": 1,\n        \"itemsPerPage\": 40,\n        \"items\": [\n            {\n                \"videoLibraryId\": 513608,\n                \"guid\": \"1ac3e3e4-81b7-46a8-8d87-694cbfef4a7e\",\n                \"title\": \"Scallions\",\n                \"description\": null,\n                \"dateUploaded\": \"2025-10-16T17:23:07.355\",\n                \"views\": 4,\n                \"isPublic\": false,\n                \"length\": 27,\n                \"status\": 4,\n                \"framerate\": 29.97,\n                \"rotation\": 0,\n                \"width\": 1920,\n                \"height\": 1080,\n                \"availableResolutions\": \"360p,480p,720p,240p,1080p\",\n                \"outputCodecs\": \"x264\",\n                \"thumbnailCount\": 14,\n                \"encodeProgress\": 100,\n                \"storageSize\": 66122960,\n                \"captions\": [],\n                \"hasMP4Fallback\": false,\n                \"collectionId\": \"\",\n                \"thumbnailFileName\": \"thumbnail.jpg\",\n                \"thumbnailBlurhash\": \"W9HV8[xsHbtQVba2NNuKSwV[...]\",\n                \"averageWatchTime\": 23,\n                \"totalWatchTime\": 93,\n                \"category\": \"other\",\n                \"chapters\": [],\n                \"moments\": [],\n                \"metaTags\": [],\n                \"transcodingMessages\": [],\n                \"jitEncodingEnabled\": false,\n                \"smartGenerateStatus\": null,\n                \"hasOriginal\": true,\n                \"originalHash\": \"12B96F44E9...\"\n            }\n        ]\n    }\n}\n<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-d2369a04');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"usage-example\">Usage Example<\/h2>\n\n\n\n<div class=\"betterdocs-code-snippet-wrapper theme-light betterdocs-code-snippet-7559d1b1\" id=\"betterdocs-code-snippet-7559d1b1\" data-language=\"javascript\" data-copy-button=\"true\">\n\n            <div class=\"betterdocs-code-snippet-header betterdocs-file-preview-header\">\n        <div class=\"betterdocs-file-preview-left\">\n                            <div class=\"betterdocs-traffic-lights\">\n                    <span class=\"traffic-light traffic-light-red\"><\/span>\n                    <span class=\"traffic-light traffic-light-yellow\"><\/span>\n                    <span class=\"traffic-light traffic-light-green\"><\/span>\n                <\/div>\n            \n            <div class=\"betterdocs-file-info\">\n                                    <div class=\"betterdocs-file-icon\">\n                                                    <span class=\"betterdocs-file-icon-emoji\">&#128196;<\/span>\n                                            <\/div>\n                \n                            <\/div>\n        <\/div>\n\n        <div class=\"betterdocs-file-preview-right\">\n                            <div class=\"betterdocs-code-snippet-copy-container\">\n                    <button class=\"betterdocs-code-snippet-copy-button\" type=\"button\" data-clipboard-target=\"#betterdocs-code-snippet-7559d1b1 .betterdocs-code-snippet-code code\" aria-label=\"Copy code to clipboard\">\n                        <svg width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <path d=\"M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\" fill=\"currentColor\"><\/path>\n                        <\/svg>\n                    <\/button>\n                                    <\/div>\n                    <\/div>\n        <\/div>\n    \n    <div class=\"betterdocs-code-snippet-content\">\n        \n        <pre class=\"betterdocs-code-snippet-code language-javascript\"><code>$params = [\n    'page'         =&gt; 1,\n    'per_page' =&gt; 20,\n    'order_by'      =&gt; 'dateUploaded',\n    'search'       =&gt; '',\n];\n\n$response = infinite_uploads_get_videos( $params );\n\nif ( $response['success'] ) {\n    foreach ( $response['data']['items'] as $video ) {\n        echo '&lt;h3&gt;' . esc_html( $video['title'] ) . '&lt;\/h3&gt;';\n        echo '&lt;p&gt;Views: ' . intval( $video['views'] ) . '&lt;\/p&gt;';\n    }\n}\n<\/code><\/pre>\n    <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\ndocument.addEventListener('DOMContentLoaded', function() {\n    \/\/ Initialize copy functionality for this specific snippet\n    const snippet = document.getElementById('betterdocs-code-snippet-7559d1b1');\n    if (snippet && window.BetterDocsCodeSnippet) {\n        window.BetterDocsCodeSnippet.initCopyButton(snippet);\n    }\n});\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"best-practices\">Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always check <code>function_exists()<\/code> before calling.<\/li>\n\n\n\n<li>Use pagination (<code>page<\/code>, <code>itemsPerPage<\/code>) for large libraries.<\/li>\n\n\n\n<li>Use <code>search<\/code> for admin dropdowns or video pickers.<\/li>\n\n\n\n<li>Cache results using transients to reduce API calls.<\/li>\n\n\n\n<li>Escape and sanitize all output.<\/li>\n\n\n\n<li>Handle exceptions and API failure states gracefully.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"requirements\">Requirements<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A version of Infinite Uploads that includes the video fetch endpoint<\/li>\n\n\n\n<li>PHP 7.4+ recommended<\/li>\n\n\n\n<li>Infinite Uploads must be connected to the IU cloud server<\/li>\n<\/ul>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>This article provides technical documentation for developers who want to integrate with the Infinite Uploads Video Library using the PHP helper function infinite_uploads_get_videos(). Use this function to retrieve cloud-hosted video objects and incorporate them into your plugin, theme, or custom workflow. infinite_uploads_get_videos() retrieves video records from the Infinite Uploads cloud library.It supports pagination, searching, and [&hellip;]<\/p>\n","protected":false},"author":3787,"featured_media":10329,"template":"","meta":{"_acf_changed":false,"wds_primary_doc_category":0,"wds_primary_doc_tag":0,"footnotes":""},"doc_category":[147],"doc_tag":[],"class_list":["post-10328","docs","type-docs","status-publish","has-post-thumbnail","hentry","doc_category-developers"],"acf":[],"year_month":"2026-06","word_count":317,"total_views":"480","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"Blake Whittle","author_nicename":"blakew","author_url":"https:\/\/infiniteuploads.com\/blog\/author\/blakew\/"},"doc_category_info":[{"term_name":"Developers","term_url":"https:\/\/infiniteuploads.com\/docs-category\/developers\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/docs\/10328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/users\/3787"}],"version-history":[{"count":0,"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/docs\/10328\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/media\/10329"}],"wp:attachment":[{"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/media?parent=10328"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/doc_category?post=10328"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/infiniteuploads.com\/api\/wp\/v2\/doc_tag?post=10328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}