1

Android MediaPlayer 支持使用包含的 HTTP Headers 设置数据源: setDataSource(Context context, Uri uri, Map headers)

但是,如果我用它来设置 HttpHeaders 是这样的:

    Map<String, String> headers = new HashMap<String, String>();
    headers.put("cookie", "rapidsession="+MyApplication.getInstance().getAccess_token());
    mediaPlayer.setDataSource(mContext, mUri, headers )

它从不在手机上播放视频:Galaxy S6 edge,android6.0.1

但是像小米一样在手机上正常玩

它可以获取 uri,我已经添加了 Internet 权限

当我播放音频时,它正在工作。但是 logcat 说:

10-19 16:45:24.145 20369-20369/com.dj.zfwx.client.activity E/ViewRootImpl: sendUserActionEvent() mView == null 10-19 16:45:24.415 20369-20369/com.dj.zfwx。 client.activity W/MediaPlayer:无法在客户端打开文件;尝试服务器端:java.io.FileNotFoundException:没有内容提供者: http: //video.zfwx.com/111/16mp4/qiyefengxian/20160923wuhua/1.m4a ?key=40a3a0ec95632f538e53b530fb02f869&start=1 10-19 16:45:36.885 20369 -21917/com.dj.zfwx.client.activity W/MediaHTTPConnection: readAt 3477123 / 32768 => java.net.ProtocolException 10-19 16:45:36.895 20369-20386/com.dj.zfwx.client.activity W/ MediaPlayer: 信息/警告 (10973, 0) 10-19 16:45:40.005 20369-20386/com.dj.zfwx.client.activity W/MediaPlayer: 信息/警告 (702, 0)

当我开始播放视频时,它无法正常工作。日志猫说:

10-19 16:45:43.235 20369-20369/com.dj.zfwx.client.activity W/MediaPlayer:无法在客户端打开文件;尝试服务器端:java.io.FileNotFoundException:没有内容提供者:http: //video.zfwx.com/111/16mp4/qiyefengxian/20160923wuhua/1.mp4 ?key=40a3a0ec95632f538e53b530fb02f869&start=3 10-19 16:45:51.275 20369-22248/com.dj.zfwx.client.activity W/MediaHTTPConnection:readAt 15539690 / 32768 => java.net.ProtocolException 10-19 16:45:51.405 20369-20369/com。 dj.zfwx.client.activity W/MediaPlayer: 这是 IMEDIA_PLAYER_VIDEO_EXIST 10-19 16:45:51.965 20369-21917/com.dj.zfwx.client.activity W/MediaHTTPConnection: readAt 107713 / 32768 => java.net.ProtocolException 10-19 16:45:52.295 20369-20387/com.dj.zfwx.client.activity W/MediaHTTPConnection: readAt 56404 / 32768 => java.net.ProtocolException 10-19 16:45:52.695 20369-21917/com。 dj.zfwx.client.activity W/MediaHTTPConnection: readAt 263623 / 32768 => java.net.ProtocolException 10-19 16:45:53.055 20369-20862/com.dj.zfwx.client.activity W/MediaHTTPConnection: readAt 107713 / 32768 => java.net.ProtocolException 10-19 16:45:53.065 20369-22248/com.dj.zfwx.client。活动 W/MediaPlayer:信息/警告 (3, 0) 10-19 16:45:53.075 20369-22248/com.dj.zfwx.client.activity W/MediaPlayer:信息/警告 (702, 0) 10-19 16 :45:53.075 20369-22248/com.dj.zfwx.client.activity E/MediaPlayer: 错误 (1, -1004) 10-19 16:45:53.085 20369-20369/com.dj.zfwx.client.activity E /MediaPlayer: isPlaying: 在状态 MEDIA_PLAYER_STATE_ERROR 10-19 16:45:53.085 20369-20369/com.dj.zfwx.client.activity E/MediaPlayer: isPlaying: 在状态 MEDIA_PLAYER_STATE_ERROR 10-19 16:45:53.085 20369-中调用20369/com.dj.zfwx.client.activity E/MediaPlayer: isPlaying: 调用状态 MEDIA_PLAYER_STATE_ERROR 10-19 16:45:53.085 20369-20369/com.dj.zfwx.client.activity E/MediaPlayer: isPlaying: 调用状态 MEDIA_PLAYER_STATE_ERROR 10-19 16:45:53.085 20369-20369/com.dj.zfwx.client.activity E/MediaPlayer: isPlaying:在状态 MEDIA_PLAYER_STATE_ERROR 10-19 16:45:53.085 20369-20369/com.dj.zfwx.client.activity E/MediaPlayer: isPlaying: 在状态 MEDIA_PLAYER_STATE_ERROR 10-19 16:45:53.085 20369-20369/com.dj 中调用.zfwx.client.activity E/MediaPlayer:错误 (1,-1004)

请帮我解决它,拜托......祝你好运再次感谢!

4

0 回答 0