From dbe5693965bb05741417039995476f24261028ff Mon Sep 17 00:00:00 2001 From: Gael Connan Date: Thu, 1 Aug 2024 16:19:53 +0200 Subject: [PATCH 1/4] add chunked uploads to the postman api description --- postman.json | 791 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 790 insertions(+), 1 deletion(-) diff --git a/postman.json b/postman.json index be4d415..95455a0 100644 --- a/postman.json +++ b/postman.json @@ -2743,6 +2743,795 @@ } ] }, + { + "name": "Video Chunks", + "item": [ + { + "name": "Upload Chunk 1: no file field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(pm.response.code).to.equal(422);\r", + "});\r", + "/* {\r", + " \"message\": \"The file field is required.\",\r", + " \"errors\": {\r", + " \"file\": [\r", + " \"The file field is required.\"\r", + " ]\r", + " }\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest(\r", + " {\r", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " method: \"POST\",\r", + " header: {\r", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", + " \"Accept\": \"application/json\",\r", + " \"Content-Type\": \"application/json\"\r", + " },\r", + " body: {\r", + " \"mode\": \"application/json\",\r", + " \"raw\": JSON.stringify(\r", + " {\r", + " 'identifier': pm.collectionVariables.get(\"videoIdentifier\"),\r", + " 'callback_url': pm.collectionVariables.get(\"videoCallbackUrl\")\r", + " }\r", + " )\r", + " }\r", + " }, function (err, response) {\r", + " var jsonData = response.json();\r", + " console.log(jsonData);\r", + " pm.collectionVariables.set('videoUploadToken', jsonData.upload_token);\r", + " console.log('set videoUploadToken to: ' + pm.collectionVariables.get('videoUploadToken'));\r", + " console.log('-------------------------------------------')\r", + " }\r", + ");\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "totalChunks", + "value": "2", + "type": "text" + }, + { + "key": "chunkNumber", + "value": "1", + "type": "text" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "The file field is mandatory." + }, + "response": [] + }, + { + "name": "Upload Chunk 1: no file", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(pm.response.code).to.equal(422);\r", + "});\r", + "/* {\r", + " \"message\": \"The file field is required.\",\r", + " \"errors\": {\r", + " \"file\": [\r", + " \"The file field is required.\"\r", + " ]\r", + " }\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest(\r", + " {\r", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " method: \"POST\",\r", + " header: {\r", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", + " \"Accept\": \"application/json\",\r", + " \"Content-Type\": \"application/json\"\r", + " },\r", + " body: {\r", + " \"mode\": \"application/json\",\r", + " \"raw\": JSON.stringify(\r", + " {\r", + " 'identifier': pm.collectionVariables.get(\"videoIdentifier\"),\r", + " 'callback_url': pm.collectionVariables.get(\"videoCallbackUrl\")\r", + " }\r", + " )\r", + " }\r", + " }, function (err, response) {\r", + " var jsonData = response.json();\r", + " console.log(jsonData);\r", + " pm.collectionVariables.set('videoUploadToken', jsonData.upload_token);\r", + " console.log('set videoUploadToken to: ' + pm.collectionVariables.get('videoUploadToken'));\r", + " console.log('-------------------------------------------')\r", + " }\r", + ");\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": [] + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "totalChunks", + "value": "2", + "type": "text" + }, + { + "key": "chunkNumber", + "value": "1", + "type": "text" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "There must be file content." + }, + "response": [] + }, + { + "name": "Upload Chunk 1: not a file", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(pm.response.code).to.equal(422);\r", + "});\r", + "/* {\r", + " \"message\": \"The file must be a file.\",\r", + " \"errors\": {\r", + " \"file\": [\r", + " \"The file must be a file.\"\r", + " ]\r", + " }\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest(\r", + " {\r", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " method: \"POST\",\r", + " header: {\r", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", + " \"Accept\": \"application/json\",\r", + " \"Content-Type\": \"application/json\"\r", + " },\r", + " body: {\r", + " \"mode\": \"application/json\",\r", + " \"raw\": JSON.stringify(\r", + " {\r", + " 'identifier': pm.collectionVariables.get(\"videoIdentifier\"),\r", + " 'callback_url': pm.collectionVariables.get(\"videoCallbackUrl\")\r", + " }\r", + " )\r", + " }\r", + " }, function (err, response) {\r", + " var jsonData = response.json();\r", + " console.log(jsonData);\r", + " pm.collectionVariables.set('videoUploadToken', jsonData.upload_token);\r", + " console.log('set videoUploadToken to: ' + pm.collectionVariables.get('videoUploadToken'));\r", + " console.log('-------------------------------------------')\r", + " }\r", + ");\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "value": "A567HILUAF84D4U699H03IN3UHISFDNILUHSFDNUHISFDNU4HIFDS34NUI3", + "type": "text" + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "totalChunks", + "value": "2", + "type": "text" + }, + { + "key": "chunkNumber", + "value": "1", + "type": "text" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "The file content must not be transmitted as a text form field." + }, + "response": [] + }, + { + "name": "Upload Chunk 1: OK", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.done).to.eql(50);\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", + "/* {\r", + " \"done\": 50\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest(\r", + " {\r", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " method: \"POST\",\r", + " header: {\r", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", + " \"Accept\": \"application/json\",\r", + " \"Content-Type\": \"application/json\"\r", + " },\r", + " body: {\r", + " \"mode\": \"application/json\",\r", + " \"raw\": JSON.stringify(\r", + " {\r", + " 'identifier': pm.collectionVariables.get(\"videoIdentifier\"),\r", + " 'callback_url': pm.collectionVariables.get(\"videoCallbackUrl\")\r", + " }\r", + " )\r", + " }\r", + " }, function (err, response) {\r", + " var jsonData = response.json();\r", + " console.log(jsonData);\r", + " pm.collectionVariables.set('videoUploadToken', jsonData.upload_token);\r", + " console.log('set videoUploadToken to: ' + pm.collectionVariables.get('videoUploadToken'));\r", + " console.log('-------------------------------------------')\r", + " }\r", + ");\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "/C:/Users/user/Videos/_chunk1/chunkedVideo.mp4" + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "totalChunks", + "value": "2", + "type": "text" + }, + { + "key": "chunkNumber", + "value": "1", + "type": "text" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "This is the simplest way to define the chunks. In this case, the chunks start counting at 1. The answer contains the percentage uploaded value, which can be used in percentage bars etc. Make sure to transmit the same file name for all chunks!" + }, + "response": [] + }, + { + "name": "Upload Chunk 2: OK", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.state).to.eql('processing');\r", + " pm.expect(pm.response.code).to.equal(201);\r", + " pm.collectionVariables.set('currentVideoVersion', jsonData.version);\r", + " console.log('set currentVideoVersion to: ' + pm.collectionVariables.get('currentVideoVersion'));\r", + "});\r", + "/* {\r", + " \"state\": \"processing\",\r", + " \"message\": \"Successfully uploaded new video version, transcoding job has been dispatched.\",\r", + " \"identifier\": \"postmanTestVideo\",\r", + " \"version\": 1,\r", + " \"public_path\": null,\r", + " \"upload_token\": \"668866635232e\",\r", + " \"hash\": null\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "/C:/Users/user/Videos/_chunk2/chunkedVideo.mp4" + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "totalChunks", + "value": "2", + "type": "text" + }, + { + "key": "chunkNumber", + "value": "2", + "type": "text" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "Number 2 is the last chunk in this example. When it has been uploaded, the regular video upload complete message is returned." + }, + "response": [] + }, + { + "name": "Upload Chunk 1 dropzone: OK", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.done).to.eql(50);\r", + " pm.expect(pm.response.code).to.equal(200);\r", + "});\r", + "/* {\r", + " \"done\": 50\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.sendRequest(\r", + " {\r", + " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " method: \"POST\",\r", + " header: {\r", + " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", + " \"Accept\": \"application/json\",\r", + " \"Content-Type\": \"application/json\"\r", + " },\r", + " body: {\r", + " \"mode\": \"application/json\",\r", + " \"raw\": JSON.stringify(\r", + " {\r", + " 'identifier': pm.collectionVariables.get(\"videoIdentifier\"),\r", + " 'callback_url': pm.collectionVariables.get(\"videoCallbackUrl\")\r", + " }\r", + " )\r", + " }\r", + " }, function (err, response) {\r", + " var jsonData = response.json();\r", + " console.log(jsonData);\r", + " pm.collectionVariables.set('videoUploadToken', jsonData.upload_token);\r", + " console.log('set videoUploadToken to: ' + pm.collectionVariables.get('videoUploadToken'));\r", + " console.log('-------------------------------------------')\r", + " }\r", + ");\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "dzuuid", + "value": "59922a52-8e64-4b23-a630-e417ad3e6e99", + "type": "text" + }, + { + "key": "dzchunkindex", + "value": "0", + "type": "text" + }, + { + "key": "dztotalfilesize", + "value": "4000314", + "type": "text" + }, + { + "key": "dzchunksize", + "value": "2097152", + "type": "text" + }, + { + "key": "dztotalchunkcount", + "value": "2", + "type": "text" + }, + { + "key": "dzchunkbyteoffset", + "value": "0", + "type": "text" + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "file", + "type": "file", + "src": "/C:/Users/user/Videos/_chunk1/chunkedVideo.mp4" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "Dropzone is also supported, including parallel uploads. Mind that the chunks start counting at 0 in this case. Make sure to transmit the same file name for all chunks!" + }, + "response": [] + }, + { + "name": "Upload Chunk 2 dropzone: OK", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Video chunk uploaded\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.state).to.eql('processing');\r", + " pm.expect(pm.response.code).to.equal(201);\r", + " pm.collectionVariables.set('currentVideoVersion', jsonData.version);\r", + " console.log('set currentVideoVersion to: ' + pm.collectionVariables.get('currentVideoVersion'));\r", + "});\r", + "/* {\r", + " \"state\": \"processing\",\r", + " \"message\": \"Successfully uploaded new video version, transcoding job has been dispatched.\",\r", + " \"identifier\": \"postmanTestVideo\",\r", + " \"version\": 1,\r", + " \"public_path\": null,\r", + " \"upload_token\": \"668866635232e\",\r", + " \"hash\": null\r", + "} */\r", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "dzuuid", + "value": "59922a52-8e64-4b23-a630-e417ad3e6e99", + "type": "text" + }, + { + "key": "dzchunkindex", + "value": "1", + "type": "text" + }, + { + "key": "dztotalfilesize", + "value": "4000314", + "type": "text" + }, + { + "key": "dzchunksize", + "value": "2097152", + "type": "text" + }, + { + "key": "dztotalchunkcount", + "value": "2", + "type": "text" + }, + { + "key": "dzchunkbyteoffset", + "value": "2097152", + "type": "text" + }, + { + "key": "identifier", + "value": "{{videoIdentifier}}", + "type": "text" + }, + { + "key": "file", + "type": "file", + "src": "/C:/Users/user/Videos/_chunk2/chunkedVideo.mp4" + } + ] + }, + "url": { + "raw": "{{domain}}/api/v1/upload/{{videoUploadToken}}", + "host": [ + "{{domain}}" + ], + "path": [ + "api", + "v1", + "upload", + "{{videoUploadToken}}" + ] + }, + "description": "Number 1 is the last chunk in this example. When it has been uploaded, the regular video upload complete message is returned." + }, + "response": [] + } + ], + "description": "Video files can be sent as multipart form attachments. The file content must be transmitted as file, not as a text form field. Make sure to transmit the same file name for all chunks!" + }, { "name": "Get public key: OK", "event": [ @@ -2862,7 +3651,7 @@ }, { "key": "domain", - "value": "transmorpher.test", + "value": "http://transmorpher.test", "type": "string" }, { From b63b3b2853d4c74721d57f315963e662d68f84b3 Mon Sep 17 00:00:00 2001 From: Marco Szulik Date: Tue, 14 Jan 2025 14:31:53 +0100 Subject: [PATCH 2/4] add instructions in readme for chunking a file on the shell --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 69314f7..1de6f36 100644 --- a/README.md +++ b/README.md @@ -516,6 +516,18 @@ In addition to the GitHub Secrets, you'll need to set the `CLIENT_CONTAINER_NAME You may use the `CLIENT_NOTIFICATION_ROUTE` env variable if you have a custom notifications url, which differs from the default client implementation. +### Chunk a file in Artisan Tinker + +Place a file called `test.mp4` in the `storage/app` folder. + +```php +$chunkSize = ; +$fh = fopen(Storage::path('test.mp4'), 'r'); + +Storage::put('chunk1/chunkedVideo.mp4', fread($fh, $chunkSize)); +Storage::put('chunk2/chunkedVideo.mp4', fread($fh, $chunkSize)); +``` + ## License The Transmorpher media server is licensed under the [MIT license](https://opensource.org/licenses/MIT). From a80e724d56f6d65ea2e1a6e34567cf1e47b2156e Mon Sep 17 00:00:00 2001 From: Marco Szulik Date: Tue, 14 Jan 2025 15:00:32 +0100 Subject: [PATCH 3/4] for postman, replace hardcoded occurrences of the domain --- postman.json | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/postman.json b/postman.json index 95455a0..64ecd01 100644 --- a/postman.json +++ b/postman.json @@ -1,10 +1,10 @@ { "info": { - "_postman_id": "aaf95d51-4e36-45f2-bfac-27119d8e6fce", + "_postman_id": "50dcf20c-b9c1-4f5c-8fcd-2e161aff5e2e", "name": "Transmorpher Server API v1", "description": "This file describes the Transmorpher Server API.\n\n- It includes examples for failed calls as well, until they are all covered in tests.\n- Filter for \": OK\" to only see correct API calls.\n \n\nConfiguration:\n\n- create a user on Transmorpher: `php artisan create:user postman postman@example.com http://amigor/transmorpher/notifications`\n- use the provided auth token and adjust the \"authToken\" variable\n- if you're using a domain different from \"transmorpher.test\", you will have to adjust the \"domain\" variable\n \n\nIf you want to use the collection with the already defined files, you will have to go to `Settings > General > Allow reading files outside working directory`, and enable the option.", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "25831362" + "_exporter_id": "24082093" }, "item": [ { @@ -2129,7 +2129,7 @@ "pm.test(\"Image not found after deletion\", function () {\r", " pm.sendRequest(\r", " {\r", - " url: \"http://transmorpher.test/api/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/media/\" + pm.collectionVariables.get(\"imageIdentifier\") + \"/versions\",\r", " method: \"GET\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -2140,6 +2140,7 @@ " var jsonData = response.json();\r", " console.log(jsonData);\r", " pm.expect(response.code).to.eql(404);\r", + " pm.expect(jsonData.message).to.eql(\"Requested Media couldn't be found.\");\r", " }\r", " );\r", "});\r", @@ -2200,7 +2201,7 @@ "exec": [ "pm.sendRequest(", " {", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/image/reserveUploadSlot\",", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/image/reserveUploadSlot\",", " method: \"POST\",", " header: {", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),", @@ -2633,7 +2634,7 @@ "pm.test(\"Video not found after deletion\", function () {\r", " pm.sendRequest(\r", " {\r", - " url: \"http://transmorpher.test/api/media/\" + pm.collectionVariables.get(\"videoIdentifier\") + \"/versions\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/media/\" + pm.collectionVariables.get(\"videoIdentifier\") + \"/versions\",\r", " method: \"GET\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -2644,6 +2645,7 @@ " var jsonData = response.json();\r", " console.log(jsonData);\r", " pm.expect(response.code).to.eql(404);\r", + " pm.expect(jsonData.message).to.eql(\"Requested Media couldn't be found.\");\r", " }\r", " );\r", "});\r", @@ -2704,7 +2706,7 @@ "exec": [ "pm.sendRequest(", " {", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/video/reserveUploadSlot\",", " method: \"POST\",", " header: {", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),", @@ -2777,7 +2779,7 @@ "exec": [ "pm.sendRequest(\r", " {\r", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/video/reserveUploadSlot\",\r", " method: \"POST\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -2886,7 +2888,7 @@ "exec": [ "pm.sendRequest(\r", " {\r", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/video/reserveUploadSlot\",\r", " method: \"POST\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -3000,7 +3002,7 @@ "exec": [ "pm.sendRequest(\r", " {\r", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/video/reserveUploadSlot\",\r", " method: \"POST\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -3110,7 +3112,7 @@ "exec": [ "pm.sendRequest(\r", " {\r", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/video/reserveUploadSlot\",\r", " method: \"POST\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -3158,7 +3160,7 @@ { "key": "file", "type": "file", - "src": "/C:/Users/user/Videos/_chunk1/chunkedVideo.mp4" + "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" }, { "key": "identifier", @@ -3189,7 +3191,7 @@ "{{videoUploadToken}}" ] }, - "description": "This is the simplest way to define the chunks. In this case, the chunks start counting at 1. The answer contains the percentage uploaded value, which can be used in percentage bars etc. Make sure to transmit the same file name for all chunks!" + "description": "This is the simplest way to define the chunks. In this case, the chunks start counting at 1. The answer contains the percentage uploaded value, which can be used in percentage bars etc. Make sure to transmit the same file name for all chunks!\n\nThe provided example video is not actually chunked. Please refer to the Transmorpher GitHub documentation if you want to chunk a video to actually test this." }, "response": [] }, @@ -3251,7 +3253,7 @@ { "key": "file", "type": "file", - "src": "/C:/Users/user/Videos/_chunk2/chunkedVideo.mp4" + "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" }, { "key": "identifier", @@ -3282,7 +3284,7 @@ "{{videoUploadToken}}" ] }, - "description": "Number 2 is the last chunk in this example. When it has been uploaded, the regular video upload complete message is returned." + "description": "Number 2 is the last chunk in this example. When it has been uploaded, the regular video upload complete message is returned.\n\nThe provided example video is not actually chunked. Please refer to the Transmorpher GitHub documentation if you want to chunk a video to actually test this." }, "response": [] }, @@ -3313,7 +3315,7 @@ "exec": [ "pm.sendRequest(\r", " {\r", - " url: pm.collectionVariables.replaceIn(\"{{domain}}\") + \"/api/v1/video/reserveUploadSlot\",\r", + " url: pm.collectionVariables.get(\"domain\") + \"/api/v1/video/reserveUploadSlot\",\r", " method: \"POST\",\r", " header: {\r", " \"Authorization\": \"Bearer \" + pm.collectionVariables.get(\"authToken\"),\r", @@ -3396,7 +3398,7 @@ { "key": "file", "type": "file", - "src": "/C:/Users/user/Videos/_chunk1/chunkedVideo.mp4" + "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" } ] }, @@ -3412,7 +3414,7 @@ "{{videoUploadToken}}" ] }, - "description": "Dropzone is also supported, including parallel uploads. Mind that the chunks start counting at 0 in this case. Make sure to transmit the same file name for all chunks!" + "description": "Dropzone is also supported, including parallel uploads. Mind that the chunks start counting at 0 in this case. Make sure to transmit the same file name for all chunks!\n\nThe provided example video is not actually chunked. Please refer to the Transmorpher GitHub documentation if you want to chunk a video to actually test this." }, "response": [] }, @@ -3509,7 +3511,7 @@ { "key": "file", "type": "file", - "src": "/C:/Users/user/Videos/_chunk2/chunkedVideo.mp4" + "src": "/C:/Windows/SystemApps/Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy/media/oobe-intro.mp4" } ] }, @@ -3525,7 +3527,7 @@ "{{videoUploadToken}}" ] }, - "description": "Number 1 is the last chunk in this example. When it has been uploaded, the regular video upload complete message is returned." + "description": "Number 1 is the last chunk in this example. When it has been uploaded, the regular video upload complete message is returned.\n\nThe provided example video is not actually chunked. Please refer to the Transmorpher GitHub documentation if you want to chunk a video to actually test this." }, "response": [] } From 1b6c3d1a9c4806a18920eb90c00546d4336e2dce Mon Sep 17 00:00:00 2001 From: Gael Connan Date: Tue, 14 Jan 2025 18:57:17 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1de6f36..6ce9831 100644 --- a/README.md +++ b/README.md @@ -518,6 +518,7 @@ You may use the `CLIENT_NOTIFICATION_ROUTE` env variable if you have a custom no ### Chunk a file in Artisan Tinker +To test video transcoding for chunked uploads, you need to cut a videofile into at least two pieces. There is no additional change to the files. It is important that both chunks have the same filename, else they cannot be joined on the other side. Place a file called `test.mp4` in the `storage/app` folder. ```php