load movie trailer in android application from imdb

1.9k views Asked by At

Is it somehow possible, you can load the movie trailers from imdb to videoView or the native android player.

so far, what i've tried. Iframe approach which let me load trailer in webview, which is exactly i don't want. Here i found a link which is something a direct link to stream.

I want this to play in video view or native android control. thanks in advance.

1

There are 1 answers

1
Mick On

The link you have above is not a direct link to the video - it is actually a link to a web page which contains an embedded player, which in turn has a link to the actual trailer video itself.

You can see the link the to the video if you use the network timeline tab in a browser inspector to look at the network requests. For your example above the client (the browser running the HTML5 page you have downloaded) is requesting the video m3u8 file with the following request:

http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-1434643350557.m3u8

This is the 'index' file for a HLS format video file - it tells the client where to request the video streams. The client then downloads the video chunk by chunk which you can see as requests for TS segments - e.g. for you example above:

http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-143464335055700002.ts

If the IMDB site does not protect or restrict the video in some way (for example only allowing it play from their embedded web page) then in theory Android should be able to play a HLS file if you point the Media Player towards the m3u8 file. In practice however Android has well know issues with HLS playback so you may find it problematic - see this summary: http://www.jwplayer.com/blog/the-pain-of-live-streaming-on-android/