问题描述
- 求解读JAVA代码,为什么MP4文件不能播放? 12C
- 下载的一个压缩包(压缩包内含mp4文件、字幕文件等),压缩包有密码,android程序用密码打开压缩文件,并执行一系列操作后,程序自动播放压缩包内的MP4文件,但MP4文件不能直接使用播放器播放,求解答如何能让mp4文件用播放器播放 。。。谢谢 。。。这里是完整代码下载链接:点击下载完整代码,(用JD-GUI直接查看Jar内的代码、0000208821-DF705DD4是去掉了扩展名的压缩文件)
下面是部分代码(代码位于jar文件内的nc.class):
import android.widget.Toast;import com.is.piano.base.ISApp;import com.ispiano.crc64.Algorithm;import java.io.File;import java.io.PrintStream;import java.util.List;import net.lingala.zip4j.core.ZipFile;import net.lingala.zip4j.exception.ZipException;import net.lingala.zip4j.model.FileHeader;import net.lingala.zip4j.model.ZipParameters;public class nc{ public static boolean a(String paramString1 String paramString2) { long l1 = System.currentTimeMillis(); ZipFile localZipFile; File localFile; try { localZipFile = new ZipFile(paramString1); localZipFile.setFileNameCharset(""GBK""); if (localZipFile.isValidZipFile()) break label101; mh.b(paramString1); throw new ZipException(""u538Bu7F29u6587u4EF6u4E0Du5408u6CD5u53EFu80FDu88ABu635Fu574F.""); } catch (ZipException localZipException) { localZipException.printStackTrace(); localFile = new File(paramString2); if (!localFile.exists()) break label99; } File[] arrayOfFile; int i; if (localFile.isDirectory()) { arrayOfFile = localFile.listFiles(); i = arrayOfFile.length; } for (int j = 0; ; j++) { if (j >= i) { label99: return false; label101: if (localZipFile.isEncrypted()) localZipFile.setPassword(""ISPiano Zhang""); List localList = localZipFile.getFileHeaders(); long l2 = 0L; for (int k = 0; ; k++) { if (k >= localList.size()) { if (l2 <= mh.b()) break; return false; } l2 += ((FileHeader)localList.get(k)).getUncompressedSize(); } localZipFile.extractAll(paramString2); mh.b(paramString1); System.out.println(""u89E3u538Bu8017u65F6uFF1A"" + (System.currentTimeMillis() - l1)); return true; } arrayOfFile[j].delete(); } } public static boolean a(String paramString1 String paramString2 String paramString3) { System.out.println(""unzipUnfinishFile + paramString1); while (true) { int i; try { String str1 = mh.c() + ""/ispiano/package_cache/"" + paramString1; ZipFile localZipFile = new ZipFile(str1); if (!localZipFile.isValidZipFile()) return false; localZipFile.setPassword(""ISPiano Zhang""); List localList = localZipFile.getFileHeaders(); Algorithm localAlgorithm = new Algorithm(); i = 0; if (i < localList.size()) continue; eg localeg = new eg(); localeg.a(Long.parseLong(paramString3.substring(0 8) + ""00"") paramString2); localeg.g(); mh.b(str1); new File(mh.c() + ""/ispiano/package_cache/"" + ""dir_"" + paramString1).delete(); return true; FileHeader localFileHeader = (FileHeader)localList.get(i); String str2 = localFileHeader.getFileName(); long l = localFileHeader.getUncompressedSize(); String str3 = localAlgorithm.getFileName(paramString2 + paramString3 + str2); File localFile = new File(mh.c() + ""/ispiano/video_cache/"" + str3); mi.c(""jing"" str3 + "" + str2 + "" "" + localFile.length() + "" + l); if ((!localFile.exists()) || (localFile.length() != l)) { mh.b(mh.c() + ""/ispiano/video_cache/"" + str3); if (mh.b() >= l) continue; Toast.makeText(ISApp.a() 2131230828 0).show(); return false; mh.a(mh.c() + ""/ispiano/package_cache/"" + ""dir_"" + paramString1); mh.a(mh.c() + ""/ispiano/video_cache/""); localZipFile.extractFile(str2 mh.c() + ""/ispiano/package_cache/"" + ""dir_"" + paramString1); new File(mh.c() + ""/ispiano/package_cache/"" + ""dir_"" + paramString1 + ""/"" + str2).renameTo(new File(mh.c() + ""/ispiano/video_cache/"" + str3)); } } catch (ZipException localZipException) { localZipException.printStackTrace(); return false; } i++; } } public static boolean b(String paramString1 String paramString2) { try { ZipFile localZipFile = new ZipFile(paramString2); ZipParameters localZipParameters = new ZipParameters(); localZipParameters.setCompressionMethod(8); localZipParameters.setCompressionLevel(5); localZipFile.addFolder(paramString1 localZipParameters); return true; } catch (ZipException localZipException) { localZipException.printStackTrace(); } return false; } public static boolean c(String paramString1 String paramString2) { try { new ZipFile(paramString1).extractAll(paramString2); return true; } catch (ZipException localZipException) { localZipException.printStackTrace(); } return false; }}
解决方案
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/* 创建VideoView对象 /
final VideoView videoView = (VideoView) findViewById(R.id.VideoView01);
/ 设置路径 /
videoView.setVideoPath(""/sdcard/test.mp4"");
/ 设置模式-播放进度条 */
videoView.setMediaController(new MediaController(Activity01.this));
videoView.requestFocus();
videoView.start();
}
你都没有加载Android内置的视频播放器,系统也不会从你的压缩文件里面加载,这是逻辑问题
解决方案二:
你学习一下怎么播放mp4然后迁到这个功能就好了
解决方案三:
需要下载DVE转换软件,视频文件,必须转换时可以使用!你是MP4转换DVD格式就行,再转换DVI,再转换MP4这样,才行,