|
| 1 | +AndroidTranscoder |
| 2 | +================= |
| 3 | + |
| 4 | +Hardware accelerated transcoder for Android, written in pure Java. |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +``` |
| 9 | +@Override |
| 10 | +protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 11 | + ParcelFileDescriptor parcelFileDescriptor = resolver.openFileDescriptor(data.getData(), "r"); |
| 12 | + FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor(); |
| 13 | + MediaTranscoder.getInstance().transcodeVideo(fileDescriptor, file.getAbsolutePath(), new MediaTranscoder.Listener() { |
| 14 | + @Override |
| 15 | + public void onTranscodeProgress(double progress) { |
| 16 | + ... |
| 17 | + } |
| 18 | +
|
| 19 | + @Override |
| 20 | + public void onTranscodeCompleted() { |
| 21 | + startActivity(new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.fromFile(file), "video/mp4")); |
| 22 | + ... |
| 23 | + } |
| 24 | +
|
| 25 | + @Override |
| 26 | + public void onTranscodeFailed(Exception exception) { |
| 27 | + ... |
| 28 | + } |
| 29 | + } |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +See `TranscoderActivity.java` in example directory for ready-made transcoder app. |
| 34 | + |
| 35 | +## License |
| 36 | + |
| 37 | +``` |
| 38 | +Copyright (C) 2014 Yuya Tanaka |
| 39 | +
|
| 40 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 41 | +you may not use this file except in compliance with the License. |
| 42 | +You may obtain a copy of the License at |
| 43 | +
|
| 44 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 45 | +
|
| 46 | +Unless required by applicable law or agreed to in writing, software |
| 47 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 48 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 49 | +See the License for the specific language governing permissions and |
| 50 | +limitations under the License. |
| 51 | +``` |
0 commit comments