据我所知,有许多免费的iptv频道可供观看。所以我想开发一个使用我的Android媒体播放器来播放这些多播流的应用程序。
有人可以指导我。
谢谢,
森
答案 0 :(得分:0)
http://iptvtalk.org/showthread.php?509-iptv
上面是一个链接,可以找到免费的内容
Ciphertv有一个网站,它自己的小盒子随附你想要的任何编程。一个价格,购买一年订阅的盒子。
SuperIPTV ....适用于几乎所有民族,包括日语,英语,中文,阿拉伯语等。只是谷歌任何漂浮你的船。
答案 1 :(得分:0)
之前我这样做...如果您只想播放多播流,请在VideoView
添加MainActivity
。例如:
VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
videoView = (VideoView) findViewById(R.id.videoView);
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
selectedVideo++;
play();
}
});
play();
}
播放功能代码:
private void play() {
String result = "udp://239.1.2.3:6001";
Uri video = Uri.parse(result);
if (videoView.isPlaying())
videoView.stopPlayback();
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
videoView.start();
}
});
}
请注意,您必须拥有已启用多播的网络才能播放多播流。
答案 2 :(得分:0)
我使用ExoMedia开发了一个个人示例。这是link,但基本上是Service和PlaylistManager的组合,用于播放多播流
// PlaylistManager.kt
/**
* A PlaylistManager that extends the [ListPlaylistManager] for use with the
* [MediaService] which extends [com.devbrackets.android.playlistcore.service.BasePlaylistService].
*/
class PlaylistManager(application: Application) :
ListPlaylistManager<ChannelItem>(application, MediaService::class.java) {
/**
* Note: You can call [.getMediaPlayers] and add it manually in the activity,
* however we have this helper method to allow registration of the media controls
* listener provided by ExoMedia's [com.devbrackets.android.exomedia.ui.widget.VideoControls]
*/
fun addVideoApi(videoApi: VideoApi) {
mediaPlayers.add(videoApi)
updateVideoControls(videoApi)
registerPlaylistListener(videoApi)
}
/**
* Note: You can call [.getMediaPlayers] and remove it manually in the activity,
* however we have this helper method to remove the registered listener from [.addVideoApi]
*/
fun removeVideoApi(videoApi: VideoApi) {
videoApi.videoView.videoControls?.setButtonListener(null)
unRegisterPlaylistListener(videoApi)
mediaPlayers.remove(videoApi)
}
/**
* Updates the available controls on the VideoView and links the
* button events to the playlist service and this.
*
* @param videoApi The VideoApi to link
*/
private fun updateVideoControls(videoApi: VideoApi) {
videoApi.videoView.videoControls?.let {
it.setPreviousButtonRemoved(true)
it.setNextButtonRemoved(true)
it.setButtonListener(ControlsListener())
}
}
/**
* An implementation of the [VideoControlsButtonListener] that provides
* integration with the playlist service.
*/
private inner class ControlsListener : VideoControlsButtonListener {
override fun onPlayPauseClicked(): Boolean {
invokePausePlay()
return true
}
override fun onPreviousClicked(): Boolean {
invokePrevious()
return false
}
override fun onNextClicked(): Boolean {
invokeNext()
return false
}
override fun onRewindClicked(): Boolean {
return false
}
override fun onFastForwardClicked(): Boolean {
return false
}
}
}
// MediaService.kt
/**
* A simple service that extends [BasePlaylistService] in order to provide
* the application specific information required.
*/
class MediaService : BasePlaylistService<ChannelItem, PlaylistManager>() {
override val playlistManager by lazy { (applicationContext as App).playlistManager }
override fun onCreate() {
super.onCreate()
// Adds the audio player implementation, otherwise there's nothing to play media with
playlistManager.mediaPlayers.add(AudioApi(applicationContext))
}
override fun onDestroy() {
super.onDestroy()
// Releases and clears all the MediaPlayersMediaImageProvider
playlistManager.mediaPlayers.forEach {
it.release()
}
playlistManager.mediaPlayers.clear()
}
override fun newPlaylistHandler(): PlaylistHandler<ChannelItem> {
val imageProvider = MediaImageProvider(applicationContext) {
playlistHandler.updateMediaControls()
}
return DefaultPlaylistHandler.Builder(
applicationContext,
javaClass,
playlistManager,
imageProvider
).build()
}
}