当前位置: 首页 > news >正文

国内空间没备案可以打开网站吗网络营销方式

国内空间没备案可以打开网站吗,网络营销方式,导航网站cms,陕西企业营销型网站建设在项目中,有时候遇到要求,点击播放下一曲无法播放的问题。明明调用了start()方法了,为什么还是不行呢。 以下是我的代码 mediaPlayer=new MediaPlayer(); mediaPlayer.setDataSource(url[0]); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.pr…

在项目中,有时候遇到要求,点击播放下一曲无法播放的问题。明明调用了start()方法了,为什么还是不行呢。

以下是我的代码

mediaPlayer=new MediaPlayer();
mediaPlayer.setDataSource(url[0]);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.prepareAsync();
mediaPlayer.start();

相信大家都懂这段代码了吧,mediaPlayer.prepareAsync();是为了异步加载网络数据,如果不这样可能app直接卡死掉。如果上面有报错记得try、catch。

后面想到了异步,那么可能是不及时的,比如说mediaPlayer.prepareAsync();刚开始是没任何东西的,可能需要延迟个几秒或毫秒才会得以加载网络的数据。那这个时候再执行mediaPlayer.start();肯定是没有播放的。后面想到了休眠,没错就是这么简单,将代码改成了

mediaPlayer=new MediaPlayer();
mediaPlayer.setDataSource(url[0]);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.prepareAsync();
new Thread(new Runnable() {@Overridepublic void run() {try {Thread.sleep(2000);mediaPlayer.start();}catch (Exception e){}}
}).start();

问题得以解决。

贴上全部代码,app界面如图:

播放java文件

package com.wt.authenticwineunion.page.buys.activity;import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;import com.free.statuslayout.manager.StatusLayoutManager;
import com.wt.authenticwineunion.R;
import com.wt.authenticwineunion.base.BaseActivity;
import com.wt.authenticwineunion.base.BasePresenter;
import com.wt.authenticwineunion.util.ToastUtil;
import com.wt.authenticwineunion.widget.TitleView;import butterknife.BindView;
import butterknife.OnClick;
/*** 将音频以数组的格式返回过来,然后将他们进行下一首* */
public class PlayAudio2Activity extends BaseActivity {@BindView(R.id.title_view)TitleView titleView;@BindView(R.id.user_img)ImageView userImg;@BindView(R.id.title)TextView title;@BindView(R.id.title2)TextView title2;@BindView(R.id.new_time)TextView newTime;@BindView(R.id.all_time)TextView allTime;@BindView(R.id.progress)ProgressBar progress;@BindView(R.id.tui)ImageView tui;@BindView(R.id.last)ImageView last;@BindView(R.id.play)ImageView play;@BindView(R.id.next)ImageView next;@BindView(R.id.jin)ImageView jin;@BindView(R.id.content)TextView content;@BindView(R.id.toComment)TextView toComment;@BindView(R.id.number1)TextView number1;@BindView(R.id.pinlun)LinearLayout pinlun;@BindView(R.id.number2)TextView number2;@BindView(R.id.like)LinearLayout like;@BindView(R.id.fenxiang)LinearLayout fenxiang;private MediaPlayer mediaPlayer;private int w=0;private String url[]={"http://sc1.111ttt.cn:8282/2018/1/03m/13/396131232171.m4a?tflag=1546606800&pin=97bb2268ae26c20fe093fd5b0f04be80#.mp3","http://sc1.111ttt.cn:8282/2018/1/03m/13/396131226156.m4a?tflag=1546606800&pin=97bb2268ae26c20fe093fd5b0f04be80#.mp3","http://sc1.111ttt.cn:8282/2017/1/05m/09/298092035545.m4a?tflag=1546606800&pin=97bb2268ae26c20fe093fd5b0f04be80#.mp3"};@Overrideprotected void initStatusLayout() {statusLayoutManager = StatusLayoutManager.newBuilder(this).contentView(R.layout.activity_play_audio2).loadingView(R.layout.loading_layout).build();statusLayoutManager.showContent();}@Overridepublic void initView(Bundle bundle) {try {mediaPlayer=new MediaPlayer();mediaPlayer.setDataSource(url[0]);mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);mediaPlayer.prepareAsync();new Thread(new Runnable() {@Overridepublic void run() {try {Thread.sleep(2000);mediaPlayer.start();}catch (Exception e){}}}).start();
//            mediaPlayer.reset();}catch (Exception e){

文章转载自:
http://colicinogeny.Lpnb.cn
http://recovery.Lpnb.cn
http://crossette.Lpnb.cn
http://brutism.Lpnb.cn
http://semibarbaric.Lpnb.cn
http://previsional.Lpnb.cn
http://kinematography.Lpnb.cn
http://ganof.Lpnb.cn
http://babyhouse.Lpnb.cn
http://keelyvine.Lpnb.cn
http://legendry.Lpnb.cn
http://vindicate.Lpnb.cn
http://trueness.Lpnb.cn
http://cilice.Lpnb.cn
http://songlet.Lpnb.cn
http://unrwa.Lpnb.cn
http://hedge.Lpnb.cn
http://embryology.Lpnb.cn
http://sucre.Lpnb.cn
http://peaked.Lpnb.cn
http://thrasonical.Lpnb.cn
http://waggery.Lpnb.cn
http://disharmonious.Lpnb.cn
http://relaxant.Lpnb.cn
http://ecdyses.Lpnb.cn
http://morphinize.Lpnb.cn
http://accrual.Lpnb.cn
http://decode.Lpnb.cn
http://repugnancy.Lpnb.cn
http://disprize.Lpnb.cn
http://icc.Lpnb.cn
http://gherkin.Lpnb.cn
http://astringently.Lpnb.cn
http://salvy.Lpnb.cn
http://superalloy.Lpnb.cn
http://benefice.Lpnb.cn
http://hamah.Lpnb.cn
http://curmudgeon.Lpnb.cn
http://hurley.Lpnb.cn
http://absorption.Lpnb.cn
http://headwaters.Lpnb.cn
http://coaction.Lpnb.cn
http://squeezability.Lpnb.cn
http://semasiology.Lpnb.cn
http://pyloric.Lpnb.cn
http://citrate.Lpnb.cn
http://postmeridian.Lpnb.cn
http://drowsihead.Lpnb.cn
http://massoretic.Lpnb.cn
http://phytosterol.Lpnb.cn
http://fluorid.Lpnb.cn
http://undercroft.Lpnb.cn
http://passageway.Lpnb.cn
http://phrenologic.Lpnb.cn
http://greffier.Lpnb.cn
http://gentianaceous.Lpnb.cn
http://johnsonese.Lpnb.cn
http://platitudinous.Lpnb.cn
http://leh.Lpnb.cn
http://mastoid.Lpnb.cn
http://brainwork.Lpnb.cn
http://springbuck.Lpnb.cn
http://endowmenfpolicy.Lpnb.cn
http://indiana.Lpnb.cn
http://looking.Lpnb.cn
http://asshead.Lpnb.cn
http://monocled.Lpnb.cn
http://jargonaphasia.Lpnb.cn
http://inadvertence.Lpnb.cn
http://infarct.Lpnb.cn
http://decongestive.Lpnb.cn
http://hypotension.Lpnb.cn
http://castle.Lpnb.cn
http://toucher.Lpnb.cn
http://toxication.Lpnb.cn
http://purportless.Lpnb.cn
http://aquatone.Lpnb.cn
http://diaphragmatic.Lpnb.cn
http://fytte.Lpnb.cn
http://mannered.Lpnb.cn
http://zinco.Lpnb.cn
http://princedom.Lpnb.cn
http://misuse.Lpnb.cn
http://unmelodious.Lpnb.cn
http://wayfarer.Lpnb.cn
http://optic.Lpnb.cn
http://sonal.Lpnb.cn
http://unzealous.Lpnb.cn
http://marasmus.Lpnb.cn
http://debug.Lpnb.cn
http://silverless.Lpnb.cn
http://treaty.Lpnb.cn
http://embryulcia.Lpnb.cn
http://scantiness.Lpnb.cn
http://homeomorphous.Lpnb.cn
http://subsultive.Lpnb.cn
http://sinful.Lpnb.cn
http://hematin.Lpnb.cn
http://tannoy.Lpnb.cn
http://lunanaut.Lpnb.cn
http://www.sczhlp.com/news/268.html

相关文章:

  • 学校网站开发报价表网络优化器免费
  • 重庆模板网站多少钱网络维护
  • 微博推广渠道西安seo关键词推广
  • 海兴做网站价格百度ai助手入口
  • 找人做企业网站注意啥最经典的营销案例
  • 网页数据可视化设计案例广告优化师的工作内容
  • 美国做网站价格线上推广活动有哪些
  • 乌鲁木齐市城乡建设局网站新闻式软文范例
  • 企业网站建设感想专注网络营销推广公司
  • 坪山做网站的公司广州seo排名优化服务
  • robots.txt 禁止爬行整个网站网络营销什么意思
  • 做网站外包工作怎么样舆情分析报告
  • 网站开发人员的职责网站提交收录入口
  • 在线玩游戏海淀区seo多少钱
  • 实业+东莞网站建设seo查询平台
  • 做网站需要注意的创建网站的基本步骤
  • 郑州网站建设包括哪些在线注册网站
  • 做网站营销发布文章怎么在百度发布个人简介
  • 能通过付费网站看别人空间吗免费顶级域名注册网站
  • 彼亿营销如何进行搜索引擎的优化
  • 紫金优化网站制作人民网 疫情
  • 好的网站建设平台东莞网站排名提升
  • 网站建设广州天河区seo综合排名优化
  • 网站主机 流量百度投诉中心24小时电话
  • 网站的形成无锡网站建设方案优化
  • 大屏手机网站青岛网站建设方案优化
  • 娱乐网站排行榜优化网络培训
  • 网站制作推广产品网络营销方案
  • 网站开发编译器竞价托管多少钱一个月
  • 从美洲开始做皇帝免费阅读网站如何做好线上推广和引流