[TIMOB-10830] Android: Ti.Media.VideoPlayer not accepting native path on Android
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Reopened |
| Resolution | Unresolved |
| Affected Version/s | Release 2.1.2 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | api, exalture |
| Reporter | Johan Lundin |
| Assignee | Unknown |
| Created | 2012-09-04T10:12:35.000+0000 |
| Updated | 2018-02-28T20:03:14.000+0000 |
Description
On android the video url must be specified as a url and always belongs in the resource folder. The following fix allows it to be consistent with the iphone call where native path can be used.
https://github.com/appcelerator/titanium_mobile/blob/2_1_X/android/modules/media/src/java/android/widget/TiVideoView8.java
Line 424-426:
String path = mUri.toString().substring("file:///android_asset/".length());
afd = getContext().getAssets().openFd(path);
mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
should be replaced with:
String path = mUri.toString().substring("file:///android_asset/".length());
// Needed to handle native path urls
path = path.replace("Resources//", "Resources/");
afd = getContext().getAssets().openFd(path);
mMediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
No comments