[TIMOB-13131] Android: Ti.Media.VideoPlayer not able to play files from internal storage
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-15T18:55:21.000+0000 |
Affected Version/s | Release 3.0.2 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Johan Lundin |
Assignee | Eric Merriman |
Created | 2012-09-04T10:18:44.000+0000 |
Updated | 2017-06-15T18:55:21.000+0000 |
Description
It is not possible to specify files on internal storage for Android like it is for iOS. This can easily be fixed as below. Then just initialise the movie player with URL just like on iOS as:
url = Ti.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, "movie.mp4").nativePath;
https://github.com/appcelerator/titanium_mobile/blob/3_0_X/android/modules/media/src/java/android/widget/TiVideoView8.java
Line 422-424
} else {
setDataSource();
}
should be replaced with:
else if(mUri.toString().startsWith(("file://"))) {
// Loading from internal storage using file desc for media player to be able to read
FileInputStream fis = new FileInputStream(mUri.toString().substring("file://".length()));
mMediaPlayer.setDataSource(fis.getFD());
}
else {
setDataSource();
}
Closing ticket due to time passed and lack of progress in the past few years. Any problems, please file a new ticket.