Make Your Own Simple Music/Video Player
Halo kisanak, semoga kalian masih survive hingga saat ini. Sebagai programmer, penggunaan framework dalam membuat sebuah program akan sangat membantu dalam proses pengembangannya. Kali ini aku mencoba membuat sebuah musik/video player yang sangat sederhana dengan menggunakan .NET FRAMEWORK. Jujurly, ini mudah banget bahkan bisa menjadi awal yang bagus untuk kalian yang mau mendalami penggunaan Framework untuk pengembangan aplikasi desktop. Seperti ini tampilan untuk Musik/Video Player yang sudah aku coba
Fitur yang terdapat dalam aplikasi, antara lain:
- Memutar musik dan menampilkan audiowave sesuai dengan musik yang diputar
- Menampilkan Video
- Mengupload multiple file
- Membuat playlist dan memutar musik/video sesuai dengan nama file yang dipilih pada kolom playlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.IO; | |
using System.Windows.Forms; | |
namespace Music_Player | |
{ | |
public partial class Form1 : Form | |
{ | |
List<string> path = new List<string>(); | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void Form1_Load(object sender, EventArgs e) | |
{ | |
} | |
private void Panel2_Paint(object sender, PaintEventArgs e) | |
{ | |
} | |
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) | |
{ | |
try | |
{ | |
axWindowsMediaPlayer1.URL = path[listBox1.SelectedIndex]; | |
} | |
catch(Exception) | |
{ | |
MessageBox.Show("List musik masih kosong, silakan open file musik terlebih dahulu"); | |
} | |
} | |
private void AxWindowsMediaPlayer1_Enter(object sender, EventArgs e) | |
{ | |
} | |
private void OpenToolStripMenuItem_Click_1(object sender, EventArgs e) | |
{ | |
openFileDialog1.FileName = ""; | |
openFileDialog1.Filter = "All Files|*.*"; | |
openFileDialog1.Multiselect = true; | |
if (openFileDialog1.ShowDialog() == DialogResult.OK) | |
{ | |
for (int i = 0; i < openFileDialog1.FileNames.Length; i++) | |
{ | |
path.Add(openFileDialog1.FileNames[i]); | |
listBox1.Items.Add(Path.GetFileNameWithoutExtension(openFileDialog1.FileNames[i])); | |
} | |
axWindowsMediaPlayer1.URL = openFileDialog1.FileNames[0]; | |
} | |
} | |
} | |
} |
Source Code diatas tidak bisa langsung digunakan dengan bermodal Copy-Paste aja. kalian bisa mengikuti Tutorial dibawah ini 👇
Komentar
Posting Komentar