[問題] 請問要怎麼做??從資料庫讀取flv檔並撥放...
小弟有個播放器如下列網址
http://abears.myweb.hinet.net/vod.swf
現在想要把video1 video2 video3 要改成能夠自動的從MySQL讀出檔案名稱...
MySQL 裡面記錄有test1 abc1 xyz1....n個檔案名稱
在sever端上面也有相對應於DataBase的檔案 test1.flv abc1.flv xyz1.flv ..n個檔
有什麼需要改什麼地方呢?? 我想用xml或是php的方式去讀取資料庫,(或任何方式皆可)
(有沒有這方面的程式範例也行....)
另外 我想要能夠等按下play按鈕之後 才開始播放第一個video1.flv 要怎麼做呢??
謝謝 各位
程式碼如下...
var my_sound = new Sound();
var connection_nc = new NetConnection();
connection_nc.connect(null);
var stream_ns = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
my_video.smoothing = true;
var currentFlV = "video1.flv";
var totaltime = 31;
stream_ns.play(currentFlV);
this.createTextField("time_txt", this.getNextHighestDepth(), 10, 10, 100, 22);
time_txt.autoSize = "left";
time_txt.text = "LOADING";
function checkTime(my_ns) {
var ns_seconds = my_ns.time;
var minutes = Math.floor(ns_seconds / 60);
var seconds = Math.floor(ns_seconds % 60);
if (seconds < 10) {
seconds = "0" + seconds;
}
time_txt.text = minutes + ":" + seconds;
if (!progress_mc.dragging) {
progress_mc.handle_mc._x = ns_seconds / totaltime * 100;
}
if (sound_mc.changingSound) {
my_sound.setVolume(sound_mc.handle_mc._x);
}
}
var time_interval = setInterval(checkTime, 200, stream_ns);
function changeVideo(flv) {
stream_ns.close();
stream_ns.play(flv);
}
play_btn.onPress = function() {
stream_ns.pause();
};
stop_btn.onPress = function() {
stream_ns.seek(0);
stream_ns.pause(true);
};
changeVideo1_btn.onPress = function() {
currentFlV = "video1.flv";
totaltime = 31;
changeVideo(currentFlV);
};
changeVideo2_btn.onPress = function() {
currentFlV = "video2.flv";
totaltime = 28;
changeVideo(currentFlV);
};
changeVideo3_btn.onPress = function() {
currentFlV = "video3.flv";
totaltime = 34;
changeVideo(currentFlV);
};
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.248.79.162
Flash 近期熱門文章
PTT數位生活區 即時熱門文章