(Photo: In case of fire, run downstairs, three steps at a time.)

วันนี้ผมแก้งานต่อ โดยสร้างหน้าต่างจัดการ playlist แบบลากวาง (drag-and-drop) โดยแม้ว่าหน้าตาจะไม่คล้าย YouTube เท่าไหร่ แต่ก็ออกแบบและใช้งานได้ง่าย ไม่ซับซ้อนเช่นกัน สำหรับการเล่นวิดีโอก็ใช้ iframe API ซึ่งใช้งานง่ายมาก โดยสามารถทำตามขั้นตอนที่กำหนดให้ หรือจะสร้าง <iframe src…> เอาเองก็ได้ โดยเปิดการใช้งาน JavaScript API เอาไว้ เพื่อควบคุมการเล่นวิดีโอผ่าน JavaScript อีกที โดยสามารถกดดูวิดีโอจากหน้าการจัด playlist เพื่อเป็นตัวอย่างได้ด้วย ส่วนที่ยากคือการเล่นไฟล์ออกมาจริงๆ เพราะเราต้องดัก event แล้วต่อไฟล์ให้ถูก แต่ถ้าเข้าใจหรือเคยทำมาแล้วก็ทำใหม่ไม่ยากเช่นกัน

อีกส่วนหลักๆ ที่ทำคือการปรับฐานข้อมูลให้เปลี่ยนไปใช้ character set แบบ utf8 แทน เนื่องจากชื่อไฟล์บน YouTube อาจมีอักขระที่ไม่ใช่ภาษาอังกฤษอยู่ ซึ่งเราต้องรองรับด้วยเวลาที่เอาใส่ในฐานข้อมูล (ที่เก็บข้อมูลชื่อไฟล์ไว้เองเพราะจะได้ไม่ต้องดึง API ใหม่บ่อยๆ)

I continued to revise my work today. First I finished building a drag-and-drop playlist manager. Even though it didn’t look like YouTube as specified, it was easily designed and simple to use. Video playback also simply uses iframe API which is also easy. User can preview the video in playlist manager screen. The main view is a bit harder due to use of events required to make file joining easy, but if you have done it before, you can do it again.

Another important part was changing the database system to use utf8 . This is simple, just use ALTER TABLE and a few other commands. This is done so we can store file titles directly in our database, because we do not want to re-query the API over and over when loading the playlist for modification.