Commit c09f6108 by kimvde Committed by christosts

Rollback of https://github.com/google/ExoPlayer/commit/ad51d1ca8766b699fe62f67e3fdf1e7363cc61ec

*** Original commit ***

Fix "Transforming media" page

Some information there is not correct anymore.

***

PiperOrigin-RevId: 503196165
parent 3055de94
Showing with 12 additions and 17 deletions
...@@ -37,14 +37,16 @@ Transformer transformer = ...@@ -37,14 +37,16 @@ Transformer transformer =
.addListener(transformerListener) .addListener(transformerListener)
.build(); .build();
// Start the transformation. // Start the transformation.
transformer.startTransformation( transformer.startTransformation(inputMediaItem, outputPath);
new EditedMediaItem(inputMediaItem), outputPath);
~~~ ~~~
{: .language-java} {: .language-java}
`startTransformation` receives an `EditedMediaItem` describing the input, and a Other parameters, such as the `MediaSource.Factory`, can be passed to the
path or a `ParcelFileDescriptor` indicating where the output should be written. builder.
The input can be a progressive or an adaptive stream, but the output is always a
`startTransformation` receives a `MediaItem` describing the input, and a path or
a `ParcelFileDescriptor` indicating where the output should be written. The
input can be a progressive or an adaptive stream, but the output is always a
progressive stream. For adaptive inputs, the highest resolution tracks are progressive stream. For adaptive inputs, the highest resolution tracks are
always selected for the transformation. The input can be of any container format always selected for the transformation. The input can be of any container format
supported by ExoPlayer (see the [Supported formats page][] for details), but the supported by ExoPlayer (see the [Supported formats page][] for details), but the
...@@ -63,16 +65,12 @@ app is notified of events via the listener passed to the `Transformer` builder. ...@@ -63,16 +65,12 @@ app is notified of events via the listener passed to the `Transformer` builder.
Transformer.Listener transformerListener = Transformer.Listener transformerListener =
new Transformer.Listener() { new Transformer.Listener() {
@Override @Override
public void onTransformationCompleted( public void onTransformationCompleted(MediaItem inputMediaItem, TransformationResult result) {
MediaItem inputMediaItem, TransformationResult result) {
playOutput(); playOutput();
} }
@Override @Override
public void onTransformationError( public void onTransformationError(MediaItem inputMediaItem, TransformationResult result, TransformationException exception) {
MediaItem inputMediaItem,
TransformationResult result,
TransformationException exception) {
displayError(e); displayError(e);
} }
}; };
...@@ -90,15 +88,13 @@ the `updateProgressInUi` method could be implemented to update a progress bar ...@@ -90,15 +88,13 @@ the `updateProgressInUi` method could be implemented to update a progress bar
displayed to the user. displayed to the user.
~~~ ~~~
transformer.startTransformation( transformer.startTransformation(inputMediaItem, outputPath);
new EditedMediaItem(inputMediaItem), outputPath);
ProgressHolder progressHolder = new ProgressHolder(); ProgressHolder progressHolder = new ProgressHolder();
mainHandler.post( mainHandler.post(
new Runnable() { new Runnable() {
@Override @Override
public void run() { public void run() {
@ProgressState int progressState = @ProgressState int progressState = transformer.getProgress(progressHolder);
transformer.getProgress(progressHolder);
updateProgressInUi(progressState, progressHolder); updateProgressInUi(progressState, progressHolder);
if (progressState != PROGRESS_STATE_NOT_STARTED) { if (progressState != PROGRESS_STATE_NOT_STARTED) {
mainHandler.postDelayed(/* r= */ this, /* delayMillis= */ 500); mainHandler.postDelayed(/* r= */ this, /* delayMillis= */ 500);
...@@ -127,8 +123,7 @@ Transformer transformer = ...@@ -127,8 +123,7 @@ Transformer transformer =
.setFlattenForSlowMotion(true) .setFlattenForSlowMotion(true)
.addListener(transformerListener) .addListener(transformerListener)
.build(); .build();
transformer.startTransformation( transformer.startTransformation(inputMediaItem, outputPath);
new EditedMediaItem(inputMediaItem), outputPath);
~~~ ~~~
{: .language-java} {: .language-java}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment