[Học phần mềm] AutoPlay 6 Nghe nhạc, xem phim trong máy tính

521
Phần này giống như bài 5./ Xem hinh trong máy tính. Nhấn nút Load chọn file trong máy tính, chọn file trong Listbox và nhấn Open để xem
  • Tạo 2 Buttons, 1 ListBox, 1 MediaPlayer (Object > Plugins > MediaPlayer)
  • On Click của Button1:
–Disable listbox Updating
ListBox.SetUpdate(“ListBox1”, false);

–Get the desired folder to browse
folder = Dialog.FolderBrowse(“Open Folder”, “C:Music”);

–populate tables with all the .jpg and .png files
file_mp3 = File.Find(folder, “*.mp3”, false, false, nil);
file_mp4 = File.Find(folder, “*.mp4”, false, false, nil);

audio = {file_mp3, file_mp4};
–do the following for each file:
for k in pairs(audio) do
    for j,file_path in pairs(audio[k]) do
       ListBox.AddItem(“ListBox1”, String.SplitPath(file_path).Filename, file_path);
    end
end

–Allow the listbox to display the updated content
ListBox.SetUpdate(“ListBox1”, true);
  • On Click của Button2:
selected = ListBox.GetSelected(“ListBox1”);
if (selected ~= nil)
then
    for j,k in pairs(selected) do
        MediaPlayer.Load(“Plugin1”, ListBox.GetItemData(“ListBox1”, k));
    end
else
    Dialog.Message(“Hello”, “Select music first!!!”)
end


 

THÔNG TIN GÓP Ý
        Quý thầy cô hoặc bạn đọc muốn đóng góp tài liệu, vui lòng gửi về:
    Fanpage: https://www.facebook.com/linhhoitrithuc (Chia sẻ tài nguyên miễn phí)
    Email: linhhoitrithuc@gmail.com  
 Tags: máy tính
Thống kê truy cập
  • Đang truy cập1
  • Hôm nay89
  • Tháng hiện tại14,980
  • Tổng lượt truy cập99,143
GIÁO ÁN THEO CHỦ ĐỀ
ĐỀ THI HK 2 TIỂU HỌC
giáo án theo công văn 5512
facebook
Đăng nhập
Hãy đăng nhập thành viên để trải nghiệm đầy đủ các tiện ích trên site
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây