Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13131] Android: Ti.Media.VideoPlayer not able to play files from internal storage

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-15T18:55:21.000+0000
Affected Version/sRelease 3.0.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterJohan Lundin
AssigneeEric Merriman
Created2012-09-04T10:18:44.000+0000
Updated2017-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();
			}

Comments

  1. Lee Morris 2017-06-15

    Closing ticket due to time passed and lack of progress in the past few years. Any problems, please file a new ticket.

JSON Source