MediaError.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Public Methods
Sets the detailed error code.
The detailed error code must be one of the constants defined in MediaError.DetailedErrorCode
.
Set to null
for unspecified.
Sets the error reason.
The reason must be one of the constants with ERROR_REASON_
prefix in MediaError
.
Sets the type of the media error.
The type must be one of the constants with ERROR_TYPE_
prefix in MediaError
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eMediaError.Builder\u003c/code\u003e is used to construct instances of \u003ccode\u003eMediaError\u003c/code\u003e, providing methods to set error details like type, reason, and detailed error code.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to specify custom data associated with the error using JSON objects.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method finalizes the construction and returns a \u003ccode\u003eMediaError\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003eError details like reason and type should align with pre-defined constants from the \u003ccode\u003eMediaError\u003c/code\u003e class for consistency.\u003c/p\u003e\n"]]],["The `MediaError.Builder` class allows for the construction of a `MediaError` object. Key actions include setting error details such as custom data using `setCustomData`, detailed error code with `setDetailedErrorCode`, error reason with `setReason`, and error type with `setType`. Finally, using `build` method creates the final `MediaError` object. The error code, reason and type should be from predefined constants.\n"],null,["# MediaError.Builder\n\npublic static class **MediaError.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder for [MediaError](/android/reference/com/google/android/gms/cast/MediaError). \n\n### Public Constructor Summary\n\n|---|------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder#Builder())() |\n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [MediaError](/android/reference/com/google/android/gms/cast/MediaError) | [build](/android/reference/com/google/android/gms/cast/MediaError.Builder#build())() Build a [MediaError](/android/reference/com/google/android/gms/cast/MediaError). |\n| [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder) | [setCustomData](/android/reference/com/google/android/gms/cast/MediaError.Builder#setCustomData(org.json.JSONObject))([JSONObject](//developer.android.com/reference/org/json/JSONObject.html) customData) Sets the custom data. |\n| [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder) | [setDetailedErrorCode](/android/reference/com/google/android/gms/cast/MediaError.Builder#setDetailedErrorCode(java.lang.Integer))([Integer](//developer.android.com/reference/java/lang/Integer.html) detailedErrorCode) Sets the detailed error code. |\n| [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder) | [setReason](/android/reference/com/google/android/gms/cast/MediaError.Builder#setReason(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) reason) Sets the error reason. |\n| [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder) | [setType](/android/reference/com/google/android/gms/cast/MediaError.Builder#setType(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) type) Sets the type of the media error. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ()\n\nPublic Methods\n--------------\n\n#### public [MediaError](/android/reference/com/google/android/gms/cast/MediaError)\n**build** ()\n\nBuild a [MediaError](/android/reference/com/google/android/gms/cast/MediaError). \n\n#### public [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder)\n**setCustomData** ([JSONObject](//developer.android.com/reference/org/json/JSONObject.html) customData)\n\nSets the custom data. \n\n#### public [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder)\n**setDetailedErrorCode** ([Integer](//developer.android.com/reference/java/lang/Integer.html) detailedErrorCode)\n\nSets the detailed error code.\n\nThe detailed error code must be one of the constants defined in [MediaError.DetailedErrorCode](/android/reference/com/google/android/gms/cast/MediaError.DetailedErrorCode).\n\nSet to `null` for unspecified. \n\n#### public [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder)\n**setReason** ([String](//developer.android.com/reference/java/lang/String.html) reason)\n\nSets the error reason.\n\nThe reason must be one of the constants with `ERROR_REASON_` prefix in\n[MediaError](/android/reference/com/google/android/gms/cast/MediaError). \n\n#### public [MediaError.Builder](/android/reference/com/google/android/gms/cast/MediaError.Builder)\n**setType** ([String](//developer.android.com/reference/java/lang/String.html) type)\n\nSets the type of the media error.\n\nThe type must be one of the constants with `ERROR_TYPE_` prefix in\n[MediaError](/android/reference/com/google/android/gms/cast/MediaError)."]]