Start a new topic

Location of local video file

Android JS SDK

Hi there,

I am looking to figure out where the downloaded/downloading video file for an AR.VideoDrawable is being stored by the SDK (when the inputted video URL is a remote location). I understand from your documentation that when a VideoDrawable is created, a corresponding MediaPlayer is created for it, and the video is being buffered somewhere in the local memory. 

I am looking to be able to access this local file because I want to open a <video> html element in cases where the target image cannot be found and thus the ImageTrackable cannot snap to screen, but do not want to load the video twice as it's data heavy. I cannot just use the media player in this instance because we also need the user to be able to access certain icons while viewing the video. 

I tried loading the video locally myself then putting that URL in the VideoDrawable element (which could also be used for the video html element) but this is not efficient because the VideoDrawable will wait for the entire video file to be downloaded before playing whereas if you input the remote URL it downloads a bit then plays while the rest is downloading. 

It would also be nice to be able to access the media player callbacks so that we can know when the video is finished playing if the user has chosen to play it in the media player.

Thank you

1 Comment

Hi Matthew,

to my understanding, we let the Android MediaPlayer class do all the work in case of a remote resource. The remote URL is simply forwarded to the media player (setDataSource function) and the streaming itself is handled by this class. What it does internally in is case of a remote video I don't know, but my guess is that there is never an actual file being created. I'd expect the streaming operation to work in memory on small chucks of the video data, never its entirety. That's my understanding of streaming anyway.

But I guess you could look into this in some more detail by researching the MediaPlayer's setDataSource function.

- Daniel

Login or Signup to post a comment