Sto sviluppando un'app in cui devo implementare lo streaming tv in diretta. La mia ricerca su Google mi ha portato a credere che lo streaming live non sia possibile fino a Android 2.1.android live streaming di tv
È giusto?
Come ottengo il codice della musica straming di mediaplayer e posso usare il tipo di esso impostando sotto metodo:
mp.setAudioStreamType(2)
;
Ma io voglio sapere è sufficiente per lo streaming proprio codice come questo e salvare il file come qui di seguito il metodo:
private void setDataSource(String path) throws IOException {
if (!URLUtil.isNetworkUrl(path)) {
mp.setDataSource(path);
} else {
Log.i("enter the setdata","enter the setdata");
URL url = new URL(path);
URLConnection cn = url.openConnection();
cn.connect();
InputStream stream = cn.getInputStream();
if (stream == null)
throw new RuntimeException("stream is null");
File temp = File.createTempFile("mediaplayertmp", "dat");
String tempPath = temp.getAbsolutePath();
FileOutputStream out = new FileOutputStream(temp);
byte buf[] = new byte[128];
do {
int numread = stream.read(buf);
if (numread <= 0)
break;
out.write(buf, 0, numread);
} while (true);
mp.setDataSource(tempPath);
try {
stream.close();
Log.i("exit the setdata","exit the setdata");
}
catch (IOException ex) {
Log.e(TAG, "error: " + ex.getMessage(), ex);
}
}
}
C'è roba in più necessaria per lo streaming live tv? Pls mi guida.
Cosa intendi per streaming TV? Quale protocollo stai usando. – dongshengcn
Esiste un'applicazione TV mobile per Android 1.x (ad esempio [SFR TV] (https://market.android.com/details?id=com.sfr.android.mobiletv&feature=search_result). Funziona solo in Francia quando hai un abbonamento SFR. – david
plz condividi come lo risolvi? –