ملف تحميل الكاميرا
يُصدِر التطبيق هذا الأمر إلى الكاميرا لبدء تحميل صورة
الفيديو من الكاميرا إلى الخادم مباشرةً. يجب أن تستخدم الكاميرا الأدوات المضمَّنة
لتشكيل طلب HTTP POST. يتم تحديد الملف المراد تحميله من خلال
fileUrl
ويجب تحميله إلى uploadUrl
باستخدام البيانات الصحيحة
التفويض الذي تم تحديده من قِبل accessToken
. تمت إضافة هذا الأمر على مستوى واجهة برمجة التطبيقات.
2.1 وذات صلة
التحميل المباشر
يمكن للمرء أن يقوم بذلك من سطر أوامر الكمبيوتر كما يلي:
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
المعلمات
fileUrl:
عنوان URL للملف المطلوب تحميله إلى الخادم
uploadUrl:
سلسلة تمثّل مكان تحميل الملف
accessToken:
هو رمز مميز يشتمل على معلومات المصادقة
التحميل. يتم الحصول عليها من خلال التطبيق وإرسالها إلى الكاميرا.
النتائج
- لا يؤدي هذا الأمر إلى عرض أي نتيجة.
الأخطاء
missingParameter:
بعض المعلمات، مثل fileUrl
، غير متوفرة.
invalidParameterName:
هناك اسم واحد أو أكثر من أسماء معلمات الإدخال
لم يتم التعرّف عليها.
- تم التعرّف على
invalidParameterValue:
اسم مَعلمة إدخال.
ولكن هناك قيمة واحدة أو أكثر تم تمريرها غير صالحة. على سبيل المثال، الملف الذي تم تحديده بواسطة
لم يتم العثور على fileUrl
.
- تعذّر تحميل الكاميرا:
uploadError:
.
مفتاح Command I/O |
|
إدخال الطلب |
{ "parameters": { "fileUrl": "URL of the file.", "uploadUrl": "A string representing where to upload the file.", "accessToken": "A token containing the authentication information." } } |
مخرجات الأوامر |
none |
مخرجات الأوامر (خطأ) |
{ "error": { "code": "uploadError", "message": "Camera failed to upload the file." } } |
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2024-08-21 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-08-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["This command, available in API level 2.1 and later, allows apps to instruct the camera to directly upload images or videos to a server."],["The camera uses provided parameters (`fileUrl`, `uploadUrl`, `accessToken`) to form and send an HTTP POST request to the specified server."],["Direct Upload requires obtaining an access token and providing the file's URL and the server's upload URL within the command parameters."],["While the command itself returns no result, potential errors during the upload process can be indicated by specific error codes like `uploadError` or `invalidParameterValue`."]]],["The app directs the camera to upload a file to a server using an HTTP POST request. Key parameters include `fileUrl` (the file's location), `uploadUrl` (the destination), and `accessToken` (authorization token). The camera utilizes these parameters to perform the upload. No direct result is returned upon command execution, but error messages such as `missingParameter`, `invalidParameterValue` or `uploadError` will be returned if the command is not correctly executed. This feature was introduced in API level 2.1.\n"]]