4

i wanted to play music and video file from ftpserver,i don't like to download it and after that play it, i just play without download like url address use in MediaPlayer class.

mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource("ftp://ip");
mediaPlayer.prepare();
mediaPlayer.start();
Payam Mobarraei
  • 197
  • 1
  • 8
  • i think you are asking about the concept of `streaming`... i am not sure if you can achieve that with `ftp-server` – Yazan Aug 23 '15 at 14:50
  • You cannot play it without downloading. The bytes have to come to you before you can do something with them. You don't have to save them to file. You just use the bytes and then throw them awy. But you have to download them. Otherwise they stay on the server. You can play them while downloading. Thats called streaming. – greenapps Aug 23 '15 at 14:50

1 Answers1

1

So what you are talking about is streaming, streaming involves the data being sent to you as you are listening to it. It comes to your device a little bit at a time, then destroys itself basically to not take up storage on the device that is playing it, this uses data if you are on a limited data plan you will use up your data fast, also if you plan to listen to it more than once it doesn't make sense not to have a local copy, why waste the data twice. If you are still interested in streaming from a server, FTP isn't how you would accomplish this, FTP is used for transferring files to the server mainly, while you can download from the server over FTP you wouldn't want to stream this way. If you are looking to setup a home media streaming server that you can access from any device so you only have to upkeep the content in one location I would recommend checking out this article. Hope this helps!

Dustin Snider
  • 678
  • 1
  • 8
  • 29