File tree Expand file tree Collapse file tree
app/src/main/java/com/frank/ffmpeg Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,9 +57,8 @@ class ProbeFormatActivity : BaseActivity() {
5757 MSG_FINISH -> {
5858 progressProbe!! .visibility = View .GONE
5959 layoutProbe!! .visibility = View .VISIBLE
60- val result = msg.obj? : msg.obj
61- if (result != null ) {
62- val mediaInfo = JsonParseTool .stringFormat(result as MediaBean )
60+ if (msg.obj != null ) {
61+ val mediaInfo = JsonParseTool .stringFormat(msg.obj as MediaBean )
6362 if (! mediaInfo.isNullOrEmpty() && txtProbeFormat != null ) {
6463 txtProbeFormat!! .text = mediaInfo
6564 }
@@ -108,6 +107,7 @@ class ProbeFormatActivity : BaseActivity() {
108107
109108 when (view?.id) {
110109 R .id.btn_probe_format -> {
110+ findViewById<ImageView >(R .id.img_frame).setImageBitmap(null )
111111 doHandleProbe(filePath)
112112 }
113113 R .id.btn_retrieve_format -> {
@@ -188,7 +188,12 @@ class ProbeFormatActivity : BaseActivity() {
188188 mHandler.obtainMessage(MSG_INFO , resultBuilder.toString()).sendToTarget()
189189
190190 // Retrieve frame with timeUs
191- val bitmap = retriever.getFrameAtTime(5 * 1000000 )
191+ val frameTime = if (duration != null ) {
192+ duration.toLong() / 3 * 1000
193+ } else {
194+ 5 * 1000000
195+ }
196+ val bitmap = retriever.getFrameAtTime(frameTime)
192197 // Retrieve audio thumbnail, if it has embedded
193198// val bitmap = retriever.audioThumbnail
194199 if (bitmap != null ) {
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public class FFmpegMediaRetriever {
3131
3232 public FFmpegMediaRetriever () {
3333 native_init ();
34- native_setup ();
34+ native_setup ();
3535 }
3636
3737 public void setDataSource (String path ) {
You can’t perform that action at this time.
0 commit comments