zoukankan      html  css  js  c++  java
  • 音乐播放器自动播放下一首歌记录

    开始的时候是按照蒋坤老师的视频教程,写的,写到了歌曲自动播放下一曲的时候,始终弹出ComException错误。不好解决,网上很多人都说是mediaplayer的内置问题。

    所以开始找网上其他大鸟是怎么实现的。

    发现了一个用timer控件实现的。想了一下timer的功能就是计时器。

    所以在winform的load实践中设置

    设置timer每三秒触发一次(判断一次)

    this.timer1.Start();//开启定时器

    然后在timer控件的tick事件中

    
    
     1 private void timer1_Tick(object sender, EventArgs e)
     2         {
     3             if (this.listBox1.SelectedIndex != -1)
     4             {
     5                 int temp = this.listBox1.SelectedIndex;
     6                 this.label1.Text += axplayer.playState.ToString() + "
    ";
     7                 if (this.axplayer.playState == WMPLib.WMPPlayState.wmppsStopped)
     8                 {
     9 
    10                     temp++;
    11                     if (temp > Ilist.Count - 1)
    12                     {
    13                         this.listBox1.SelectedIndex = 0;
    14                         axplayer.URL = Ilist[0];
    15                         Myplay(0);//播放音乐的方法
    16                     }
    17                     else
    18                     {
    19                         this.listBox1.SelectedIndex = temp;
    20                         this.axplayer.URL = Ilist[temp];
    21                         Myplay(temp);//播放音乐的方法
    22                     }
    23                     
    24                 }
    25                 
    26             }
    tick事件
  • 相关阅读:
    Mysql 数据库 表中列的操作
    FreeSWITCH版本更新
    shell脚本58问
    Wireshark 与 Tcpdump
    Mysql 中 int(3) 和 int(11) 的区别
    FreeSWITCH 基础
    FreeSWITCH 学习笔记(一)
    Mysql 复制表数据(表结构相同)
    Centos date 设置自定义时间
    Mysql 主键
  • 原文地址:https://www.cnblogs.com/lierjie/p/3616980.html
Copyright © 2011-2022 走看看