要在WebView中播放MP4视频,您需要首先在列表中声明Content Provider-
<provider android:name = "MyDataContentProvider" android:authorities="com.myapp" />
用open()
方法实现打开文件-
URI myURL = URI.create("file:///mypath/new.mp4"); File f = new File(myURL); ParcelFileDescriptor p = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY); return p;