| | |
| | | import android.os.Handler; |
| | | import android.util.Log; |
| | | |
| | | import com.danikula.videocache.HttpProxyCacheServer; |
| | | import com.google.android.exoplayer2.ExoPlayer; |
| | | import com.google.android.exoplayer2.MediaItem; |
| | | import com.google.android.exoplayer2.PlaybackException; |
| | | import com.google.android.exoplayer2.Player; |
| | | import com.google.android.exoplayer2.SimpleExoPlayer; |
| | | import com.google.android.exoplayer2.source.MediaSource; |
| | | import com.sinata.xqmuse.utils.cache.PreloadManager; |
| | | import com.sinata.xqmuse.utils.cache.ProxyVideoCacheManager; |
| | | import com.sinata.xqmuse.utils.exo.ExoMediaPlayer; |
| | | import com.sinata.xqmuse.utils.exo.ExoMediaPlayerFactory; |
| | | |
| | |
| | | isPause = false; |
| | | try { |
| | | Log.e("mmp", "开始播放 path:" + filePath); |
| | | MediaItem mediaItem = MediaItem.fromUri(Uri.parse(filePath)); |
| | | HttpProxyCacheServer cacheServer = ProxyVideoCacheManager.getProxy(context); |
| | | String proxyUrl = cacheServer.getProxyUrl(filePath); |
| | | MediaItem mediaItem = MediaItem.fromUri(Uri.parse(proxyUrl)); |
| | | mMediaPlayer.setMediaItem(mediaItem); |
| | | mMediaPlayer.prepare(); |
| | | mMediaPlayer.play(); |
| | |
| | | isPause = false; |
| | | try { |
| | | Log.e("mmp", "循环播放 path:" + filePath); |
| | | MediaItem mediaItem = MediaItem.fromUri(Uri.parse(filePath)); |
| | | HttpProxyCacheServer cacheServer = ProxyVideoCacheManager.getProxy(context); |
| | | String proxyUrl = cacheServer.getProxyUrl(filePath); |
| | | MediaItem mediaItem = MediaItem.fromUri(Uri.parse(proxyUrl)); |
| | | mMediaPlayer.setMediaItem(mediaItem); |
| | | mMediaPlayer.prepare(); |
| | | mMediaPlayer.setRepeatMode(Player.REPEAT_MODE_ONE); |