Media3 Transformer is actively under development and we are looking to hear from you! We welcome your feedback, feature requests and bug reports in the
issue tracker. Follow the
ExoPlayer blog for the latest updates.
התאמה אישית
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כדי לשלוט בהתנהגות של הטרנספורמר, אפשר להגדיר אפשרויות בסביבת ה-API
או להחליף חלקים של פונקציונליות לחלוטין על ידי כתיבת יישומים מותאמים אישית
של ממשקים והעברתם. בדף הזה מתוארות כמה דוגמאות.
בקרה על הגדרת קודק
כברירת מחדל, הטרנספורמר יחזור לרזולוציה נתמכת אם
מקודד החומרה של המכשיר לא מקבל את רזולוציית הפלט המבוקשת. עבור
לדוגמה, הטרנספורמר יכול ליישר את הרוחב והגובה של הפלט כך שיהיו כפולה של 2
או 16 כפי שנדרש על ידי מקודדי חומרה. אפשר להשבית את ההתנהגות הזו
כך שבמקום זאת הטרנספורמר יקפיץ שגיאה אם הוא לא יכול להפיק
רזולוציית פלט:
Kotlin
transformerBuilder
.setEncoderFactory(
DefaultEncoderFactory.Builder(context)
.setEnableFallback(false)
.build())
Java
transformerBuilder
.setEncoderFactory(
new DefaultEncoderFactory.Builder(context)
.setEnableFallback(false)
.build());
באופן דומה, DefaultEncoderFactory
תומך גם בקידוד מותאם אישית
הגדרות באמצעות האפשרות setRequestedVideoEncoderSettings
.
אפשר גם להחליף לגמרי את המפעלים כדי שמקודדים ומפענחים יקבלו
שליטה מלאה באופן שבו רכיבי הקודק יוגדרו.
מיקסרים בהתאמה אישית
אפשר להגדיר מיקסר מותאם אישית לכתיבת קונטיינרים של מדיה באמצעות התקשרות
Transformer.setMuxerFactory
לדוגמה, אם אתם מיישמים מק"ט משלכם ב-
ברמת האפליקציה, אפשר לכתוב wrapper שמטמיע את Muxer
ואז להשתמש בפונקציה setMuxerFactory
כדי להחדיר אותו לטרנספורמר.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Customization\n\nTo control Transformer's behavior, you can configure options in the API surface\nor replace pieces of functionality completely by writing custom implementations\nof interfaces and passing those in. This page describes some examples.\n\nControl codec configuration\n---------------------------\n\nBy default, Transformer will fall back to a supported resolution if the\ndevice's hardware encoder doesn't accept the requested output resolution. For\nexample, Transformer can align the output width and height to be a multiple of 2\nor 16 as is often required by hardware encoders. You can turn off this behavior\nso that Transformer instead throws an error if it can't produce the required\noutput resolution: \n\n### Kotlin\n\n```kotlin\ntransformerBuilder\n .setEncoderFactory(\n DefaultEncoderFactory.Builder(context)\n .setEnableFallback(false)\n .build())\n```\n\n### Java\n\n```java\ntransformerBuilder\n .setEncoderFactory(\n new DefaultEncoderFactory.Builder(context)\n .setEnableFallback(false)\n .build());\n```\n\n\u003cbr /\u003e\n\nSimilarly, the `DefaultEncoderFactory` also supports using custom encoding\nsettings with the `setRequestedVideoEncoderSettings` option.\n\nYou can also completely replace the factories for encoders and decoders to get\nfull control over how the codecs are set up.\n\nCustom muxers\n-------------\n\nYou can set a custom muxer for writing media containers by calling\n`Transformer.setMuxerFactory`. For example, if you implement your own muxer at\nthe application level, you can write a wrapper that implements the `Muxer`\ninterface and then use `setMuxerFactory` to inject it into Transformer."]]