Play video from json urls in Amazon Fire TV

Posted By : Rohit Kaushik | 12-Nov-2014

In the previous blog , I explained you how to load a image from JSON. That JSON have a jsonarray i.e. “video”. Video jsonarray have many fields  likes title , description , url , thumbnail.

    "video": [{ 
	        "title": "logo check", 
			"Description": "This is the description of Ist video", 
			"url": "", 
			"thumbnail": { 
			      "thumbnailHD": "", 
		    "title": "logo check", 
			"Description": "This is the description of Ist video", 
			"url": "", 
			"thumbnail": { 
			      "thumbnailHD": "", 

Now I will explain you how to play a video in Amazon Fire TV app.In the previous blog we parse this json.Now I call a VideoActivity class for playing a video.
We have to create a different activity because we want to play a video on another window. Whenever we want to perform any task on a seperate window then we have to create an another Activity class. For starting another activity we have to use "Intent".
An Intent is an object that provides runtime binding between separate components (such as two activities).
In we used Intent and pass "VideoActivity.class" as a argument.

Intent in = new Intent(getApplicationContext(),VideoActivity.class); 
in.putExtra(TAG_URL, Video); 

 The putExtra() method takes the key name in the first parameter and the value in the second parameter.

public class VideoActivity extends Activity { 
	private static final String TAG_URL = "url"; 
	public MediaController mediaController; 
	public ProgressDialog pDialog; 
	public VideoView videoView; 
	public String videourl; 
	public Uri video; 
	protected void onCreate(Bundle savedInstanceState) { 
		    Intent in = getIntent(); 
		    videourl = in.getStringExtra(TAG_URL); 
			videoView = (VideoView) findViewById(; 
			mediaController=new MediaController(VideoActivity.this); 
		catch(Exception e){ 
			// TODO: handle exception 
			Toast.makeText(this, "Error connecting", Toast.LENGTH_SHORT).show(); 

This simplest way to display the video in our fire tv application is to use VideoView class.
This is a visual component which, when added to the layout of an activity, provides a surface onto which a video played.
If a video is simply played using the VideoView class, the user will not be given any control over the playback,which will run until the end of the video is reached. This issue can be addressed by attaching an instance of the MediaController class to the VideoView instance. The MediaController will then provide a set of controls allowing the user to manage the playback (such as pausing and seeking backwards/forwards in the video timeline).

I hope this will be helpful for you.


Rohit Kaushik     

About Author

Author Image
Rohit Kaushik

Rohit is a bright IPTV Developer and have worked on various developments.

Request for Proposal

Name is required

Comment is required

Sending message..