This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Flash Site Design > January 2007 > Flash Video Player
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Flash Video Player
|
|
| pickle jar 2007-01-10, 6:38 pm |
| Hi all,
I have just completed a fully functional flv player built using actionscript
as opposed to the FLVPlayback component. For pulling in the flvs I use an xml
file which is displayed in a listbox component. I have chosen a vertical
display for the controls instead of the usual horizontal and have created tool
tips for the volume scrubber and an altered context menu for right click.
Anyway, would be good to hear what people think, people can have the swf and
xml file if they want to use on their site, no drama...
Check my blog for more info..
Si
http://www.nutrixinteractive.com/blog/?p=19
| |
| Santhoshdotcom 2007-01-10, 6:38 pm |
| Wow Nice...
I created same kid of video player, I have a problem with mine. I want to auto
play the next clip from the XML file. Could you show me your code. Here is my
code. May be you can help me to fix this one.
Wow Nice...
I created same kid of video player, I have a problem with mine. I want to auto
play the next clip from the XML file. Could you show me your code. Here is my
code. May be you can help me to fix this one.
stop();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(25);
ns.onStatus = function(info){
if (info.code == "NetStream.Buffer.Full"){
bufferClip._visible=false;
}
if (info.code == "NetStream.Buffer.Empty"){
bufferClip._visible=true;
}
if (info.code == "NetStream.Play.Stop"){
ns.seek(0);
}
}
theVideo.attachVideo(ns);
var vlist:XML =new XML();
vlist.ignoreWhite = true;
vlist.onLoad = function() {
var videos:Array = this.firstChild.childNodes;
for (i=0;i<videos.length;i++){
videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
}
ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
}
videoList.addEventListener("change",vidList);
vlist.load("videos.xml");
| |
| pickle jar 2007-01-10, 6:38 pm |
| Hi and thanks for the feedback man,
I have kinda done it in a fashion I am not 100% happy with at the moment and
after a bit of guidance from http://www.flashcomguru.com/ am going to change
how I have achieved the video proceeding onto the next in playlist. Here is
how I achieved it for the moment though, hope it helps:
//Set up an if statement in the netstream onStatus method
if(info.code == "NetStream.Play.Stop") {
video_mc.pBtn.play_btn._visible = true;
video_mc.pBtn.pause_btn._visible = false;
nextVideo();
}
/*
Created a method to check for next track, if the currently playing video
is == to the total amount in the array (provided my the xml) i.e final
video the go back to the beginning. If not then increment the selected
index by 1 and play that selectedIndex.data....
Seems crude and there is a better way but as most people seem to tell me
.....it works so hey ;-)
*/
nextVideo = function () {
if(video_mc.listBox.lb.videoList.selectedIndex == (totalVideos)-1) {
video_mc.listBox.lb.videoList.selectedIndex = 0;
vidList.dispatchEvent({type:"change", target:vidList})
ns.play(video_mc.listBox.lb.videoList.getItemAt(video_mc.listBox.lb.videoList.s
electedIndex).data); } else {
video_mc.listBox.lb.videoList.selectedIndex =
(video_mc.listBox.lb.videoList.selectedIndex +1);
vidList.dispatchEvent({type:"change", target:vidList})
ns.play(video_mc.listBox.lb.videoList.getItemAt(video_mc.listBox.lb.videoList.s
electedIndex).data);
}
/*
Oh and dont forget to create an object to handle the dispatch event in
the above function, this basically moves on the selection in the list box or
you will find that the highlighted video does not correlate to whats playing :(
*/
var vidList:Object = new Object();
vidList.change = function(evt_obj) {
ns.play(video_mc.listBox.lb.videoList.getItemAt(video_mc.listBox.lb.videoList.s
electedIndex).data);
}
// Register listener to listbox
video_mc.listBox.lb.videoList.addEventListener("change", vidList);
| |
| Santhoshdotcom 2007-01-10, 6:38 pm |
| Thanks Man!
You did code little diffrent than mine. I look at ur code and find my problem
is. If you want to create a smilier looking player go to this site
http://www.gotoandlearn.com/ . It teach you how to create a flash player from
scrach.
Thanks Man!
this is ths code i was looking for.
//...............................
if (info.code == "NetStream.Play.Stop"){
var t = videoList.selectedIndex + 1;
if (t < videoList.length) {
ns.play(videoList.getItemAt(t).data);
videoList.selectedIndex = t;
}
ns.seek(0);
}
//--
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|