Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Video 'Channels' - Dynamic Playlist From A Combo Box



I've got my video player all set to go. Everything works, I have no problems.-Video Player-Play, Pause and Skip Buttons-Dynamic Playlist from XML (automatically/dynamically adds and creates unlimited amount of playlist items, positions them properly and sizes them properly)-Currently Playing Captions-Playlist changes color to reflect which movie is playing, etc.-XML DrivenNow, I want to do one more thing: Have channels from a combo box. Depending on which "category" the user chooses from the drop down box, I want a video playlist to be generated dynamically from their choice.How should I go about doing this? Loading multiple XML pages - each is a different channel...depending on which category is clicked, that XML page is called and generates the list? Is that even possible? Any other suggestions? Thanks!



General Flash
Posted on: Mon Jul 17, 2006 5:22 am


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Dynamic Video And Playlist Using XML
I am in desperate need of help. Im trying to build a Video Player that gets its playlist from an XML file and loads the .swf's into a target movie holder. I've attached my simple xml data. basically i want "title" to display as text in a playlist and "movie" to load into target empty MC in my flash doc when the item is selected in the playlist. If you can help i'd appreciate it and i can send source files if it helps. thanks.

Dynamic Video Playlist
Hi, I am new to Actionscript 3 and I have followed the tutorial regarding creating a dynamic video playlist with thumbnails. I created as the tutorial said and it worked fine. Instead of their just being a title for a video, I have also tried to add a description to each tileitem, but instead the title repeats twice. Can anyone see where i'm going wrong? You can view my playlist here - www.coolmustard.co.uk/VideoPlaylist.html

Thumb actionscript file:
package {
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ImageCell;
import fl.controls.TileList;
import flash.text.*;

public class Thumb extends ImageCell implements ICellRenderer {
private var desc:TextField;
private var info:TextField;
private var textStyle:TextFormat;

public function Thumb() {
super();

loader.scaleContent = false;
useHandCursor = true;

// set skins
setStyle("upSkin", ThumbCellBg);
setStyle("downSkin", ThumbCellBg);
setStyle("overSkin", ThumbCellBgOver);

setStyle("selectedUpSkin", ThumbCellBgOver);
setStyle("selectedDownSkin", ThumbCellBgOver);
setStyle("selectedOverSkin", ThumbCellBgOver);

// Create and format desc
desc = new TextField();
desc.autoSize = TextFieldAutoSize.LEFT;
desc.x = 80;
desc.y = 4;
desc.width = 500;
desc.multiline = true;
desc.wordWrap = true;
addChild(desc);

textStyle = new TextFormat();
textStyle.font = "Arial";
textStyle.color = 0xffffff;
textStyle.size = 11;
textStyle.bold = true;

info = new TextField();
info.autoSize = TextFieldAutoSize.LEFT;
info.x = 80;
info.y = 15;
info.width = 500;
info.multiline = true;
info.wordWrap = true;
addChild(info);
}

override protected function drawLayout():void {
// Position cell elements; tweak these for your thumbs if needed
var imagePadding:Number = getStyleValue("imagePadding") as Number;
loader.move(11, 8);

var w:Number = width-(imagePadding*2);
var h:Number = height-(imagePadding*2);

if (loader.width != w && loader.height != h) {
loader.setSize(w,h);
}

loader.drawNow();

desc.text = data.label;
desc.setTextFormat(textStyle);

info.text = data.label;
info.setTextFormat(textStyle);

background.width = width+5;
background.height = height+2;
textField.visible = false;
}
}
}

Videoplaylist actionscript code:
package {
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import fl.controls.listClasses.CellRenderer;
import fl.controls.ScrollBarDirection;

public class VideoPlaylist extends MovieClip {
private var xmlLoader:URLLoader;

public function VideoPlaylist():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(600, 240);
tileList.columnWidth = 580;
tileList.rowHeight = 60;
tileList.direction = ScrollBarDirection.VERTICAL;
tileList.setStyle("cellRenderer", Thumb);
}

public function initMediaPlayer(event:Event):void {
var myXML:XML = new XML(xmlLoader.data);
var item:XML;
for each(item in myXML.vid) { // populate playlist.
// Get thumbnail value and assign to cellrenderer.
var thumb:String;
if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
// Send data to tileList.
tileList.addItem({label:item.attribute("desc").toXMLString(), label:item.attribute("info").toXMLString(),
data:item.attribute("src").toXMLString(),
source:thumb});;
}
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into myVid.
myVid.source = tileList.selectedItem.data;
// Pause video until selected or played.
myVid.play();
}


// Detect when new video is selected, and play it
function listListener(event:Event):void {
myVid.play(event.target.selectedItem.data);
}


}
}

XML Playlist:
<?xml version="1.0" encoding="UTF-8"?>
<playlist id="Adobe Developer Center - Dynamic Video Playlist in AS3" >
<vid desc="Champneys Spa's and Resorts"
info="Enter a short description here"
src="

Dynamic Video Playlist And Dynamic Text Articles
Hi all, hope you can help me..?

I have the task of creating a Dynamic Video Playlist to be incorporated in a FLASH 8/HTML site. The site owner should then be able to upload their recorded videos. The client will be using a low budged camera. I am planning to suggest a video format to the client that will suit me best.

In addition I also need to create a section where text articles will be posted by the site owner.

I am a beginner in Actionscript 2.0, and I have Flash 8 installed in my PC.

Can anyone recommend some FLA source files to get me started, and a tutorial? I've seen some tutorials, but they are either too complicated or don't attend my needs.

Many thanks!

Dynamic Video Playlist Using XML (Flash 8)
Hello all, this is driving me crazy, I got no help in the 'Flash Video' forum, so I thought I'd relocate it since I suppose it's really an Actionscriptissue..

I'm using the tutorial that Lisa Larson-Kelley wrote some time ago about using XML and Actionscript to create a dynamic playlist inside of Flash.

The link can be found here. And I think I've attached the files.

I love it and it works great, but I need to add playback controls to the video that it pulls in any ideas?

Dynamic XML Playlist Won't Load Video From Different App Folder
Dear all,

This has been budging my for few days. I need some help here!

I used Lisa's Larson Dynamic Playlist to playback my recorded flvs. My recorded flv is in the applications/myrecord/streams/_definst_ (there's another .asc file (nabcapture.asc)which controls the recording)

The application folder to playback is in the applications/playback/streams/_definst_ folder with a main.asc

If all the flvs are located in the playback application folder, it works fine. But if I edited the script to point to the myrecord folder, the video did not load.

My guess would be the main.asc is controling the playback. But I can't place the main.asc to myrecord app folder because it has the highest priority and it will screw my recording functionality.

Any clue?

Dynamic Video Playlist -- Different Style, But Want An Intro
Hi all,

I have a dynamic video playlist that uses an flvplayback and tilelist components. The tileList holds the video thumbnail and description within the XML the playback plays the appropriate video in the playback. Easy enough.

What I want to do is play an "intro" video in the playback when the HTML page first loads, play it only once then freeeze on the last frame and wait for the user to click from the tileList which vid to play.

My problem is I can't tell the playback to autoplay the intro video directly using the flv location or URL it just overrides it and plays the first video in the xml list. I want it to play the intro video but I don't want that intro video to be listed as an option within the list.

You are the smart ones! What the heck should I do!? I was thinking of playing a seperate videoplayback that loads the intro video and then disappears after it's done to allow the user to click and select one - that' s my bandaid solution. But maybe you all have an idea of a smarter solution. Another monkey wrench is... I did this with a non-gotoandlearn tutorial I know I know but I needed thumbnails for my videos!!

Here is my as code:
Code:

package {
   import flash.display.MovieClip;
   import flash.net.URLLoader;
   import flash.net.URLRequest;
   import flash.events.Event;
   import fl.controls.listClasses.CellRenderer;
   import fl.controls.ScrollBarDirection;

   public class VideoPlaylist extends MovieClip {
      private var xmlLoader:URLLoader;
      
      public function VideoPlaylist():void {
         // Load the playlist file, then initialize the media player.
         xmlLoader = new URLLoader();
         xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
         xmlLoader.load(new URLRequest("playlist.xml"));
         // Format the tileList, specify its cellRenderer class.
         tileList.setSize(250, 240);
         tileList.columnWidth = 180;
         tileList.rowHeight = 60;
         tileList.direction = ScrollBarDirection.VERTICAL;
         tileList.setStyle("cellRenderer", Thumb);
      }
      
      public function initMediaPlayer(event:Event):void {
         var myXML:XML = new XML(xmlLoader.data);
         var item:XML;
         for each(item in myXML.vid) { // populate playlist.
            // Get thumbnail value and assign to cellrenderer.
            var thumb:String;
            if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
            // Send data to tileList.
            tileList.addItem({label:item.attribute("desc").toXMLString(),
            data:item.attribute("src").toXMLString(),
            source:thumb});;
         }
         // Select the first video.
         tileList.selectedIndex = 0;
         // Listen for item selection.
         tileList.addEventListener(Event.CHANGE, listListener);
         // And automatically load it into myVid.
         myVid.source = tileList.selectedItem.data;
         // Pause video until selected or played.
         myVid.pause();
      }

      
      // Detect when new video is selected, and play it
      function listListener(event:Event):void {
         myVid.play(event.target.selectedItem.data);
      }
      
      
   }
}

Any help will be cherished and honored

Creating A Dynamic Playlist For Streaming Flash Video
Hello,

I have been trying the tutorial given by Lisa Larson in order to create a dynamic playlist for streaming Flash video files. I have realized some of the FLV files that I have downloaded from internet don’t show in the thumbPlayList and cannot be played. But once I convert them back to WMV and the use the Flash 8 Video Decoder to convert them to FLV file everything works fine.

Any idea or suggestion why there is such a problem?

Thank you for your advice.

Babak
ps. This is the link to the tutorial I mentioned ...



























Edited: 01/07/2007 at 11:47:24 AM by Khoramdin

Creating A Dynamic Playlist For Streaming Flash Video Article...
Some of you might be familiar with this tutorial. It is here:

http://www.adobe.com/devnet/flash/ar...eo_player.html

I loaded this and set everything up correctly, but there is a problem. The videos and thumbnails come up.. things work great initially, but after a few clicks, the "stop" button on the video controls will start flashing on and off on a video... either that or a video will play the first frame or two and then stop. After this happens, you cannot get any videos to play.

I would appreciate if one of you who knows alot about Flash could download this tutorial and take a look. The only thing I found was a descrepency in the tutorial here:

http://www.adobe.com/devnet/flash/ar...player_04.html

"Creates the reset variable and initially sets its value to true. This variable will be used in the ns.play method three lines below. This causes the existing NetStream instance to be flushed, stopping any video currently being played and immediately playing the newly selected video. The reset variable is then set to false for the rest of the files in the playlist."

The reset variable appears to be doing nothing in the Videosource AS code. There is no ns.play either. The only thing I could think of is that the connections aren't getting flushed and the player just gets screwed up after a certain amount of clicking on the videos in the listbox. It looks like there is missing code?

Any idea? Anyone know how to fix this?

Desparate Quarterly Bonus At Stake - Video Dynamic Playlist
I was able to recreate the video playslit from the articles on Adobe.com, but my boss wants to have multiple lines of text next to each video in the list box. Anyone know how I can do this? HELP!
http://www.adobe.com/devnet/flash/articles/prog_download.html

Trouble With Creating A Dynamic Playlist For Progressive Flash Video
Hey There,

I have been working on building a flash video player and are trying to incorporate the Dynamic Playlist for Progressive Flash Video. Everyting is working expect the thumbs are not appearing. Instead, on each row of the list it says " type function". The list is populated with data b/c i can navigate it and select a video to watch, just the thumbs are missin.

Any ideas how I can get my jpg thumbs to appear?

thanks

Creating A Video Player With Dynamic Draggable Playlist. Is It Doable In Flash? Help Please
Hello Everyone,

I am scripting a video player and one of its functionalities is to be able to have a playlist that can be arranged by the user in any order user like. For Example, if there are lets say 5 videos within the playlist:

SONG 1
SONG 2
SONG 3
SONG 4
SONG 5

User can then change the order of the videos by clicking on any video and dragging it up or down just like windows mediaplayer and the player should play the videos in such order.

So far, I have been able to use the list component but am not sure if it will allow the dragging.

I would highly appreciate it if you guys can suggest what should I do to handle this functionality.

Thanks.

Problem With Tutorial:Creating A Dynamic Playlist For Streaming Flash Video
hi, anyone tried the tutorial: creating a dynamic playlist for streaming flash video?

i follow the instruction exactly as stated in the tutorial and test the fla file, it worked perfectly well when i open the swf using the macromedia flash 8. Everything look fine. Nothing is changed except the url is changed to "rtmp://localhost/videosource" in the xml file.

after i publish the file using the setting: access network only, i try to open the swf and html file from the folder, the thumbnail did not appear and there is no way i can click on any videos. What i see is only the list, and there is no response from the flash media server 2. All the files is in the same folder. Anyone please help with this problem???? thanks

Video/flash Alpha Channels
if i import a video to flash will flash maintain the alpha channels?
eg. i have a clip of someone talking and i have keyed out the background so when i import this to flash will flash maintain this keyed background or does it require a background???
ta B

Video/flash Alpha Channels
if i import a video to flash will flash maintain the alpha channels?
eg. i have a clip of someone talking and i have keyed out the background so when i import this to flash will flash maintain this keyed background or does it require a background???
ta B

Sound Channels And Live Video Feeds
Hello All,

I spent the better part of the afternoon researching this one and have come up empty handed. The app I am designing displays two live webcam streams from an FMS. What I want to do is control the audio from each stream so that camera1's audio plays in the left speaker only and camera2's audio plays in the right speaker only. I know this is done via soundchannels and soundTransforms, but how do you associate a soundChannel with the audio from a live webcam stream? All of the documentation I have read illustrates how to associate a soundChannel with a static mp3 file. ie:


Code:

sc = s.play();
The following code is what I am working with thus far. All I have been able to do is successfully control the volume with a soundTransform, but I can't seem to do anything with pan and I think it is because I am lacking the knowledge concern creating a soundChannel to control a live webcam stream:


Code:

inStream1 = new NetStream(client_nc);

incomingVid1.attachNetStream(inStream1);

trans1 = new SoundTransform();

trans1.volume = .5;

trans1.pan = -1; //doesn't work

inStream1.soundTransform = trans1;

inStream1.play(video1);





inStream2 = new NetStream(client_nc);

incomingVid2.attachNetStream(inStream2);

trans2 = new SoundTransform();

trans2.volume = .5;

trans2.pan = 1; //doesn't work

inStream2.soundTransform = trans2;

inStream2.play(video2);
Thank you for your time and energy!

Nate

Sound Channels And Live Video Feeds
Hello All,

I spent the better part of the afternoon researching this one and have come up empty handed. The app I am designing displays two live webcam streams from an FMS. What I want to do is control the audio from each stream so that camera1's audio plays in the left speaker only and camera2's audio plays in the right speaker only. I know this is done via soundchannels and soundTransforms, but how do you associate a soundChannel with the audio from a live webcam stream? All of the documentation I have read illustrates how to associate a soundChannel with a static mp3 file. ie:


Code:

sc = s.play();
The following code is what I am working with thus far. All I have been able to do is successfully control the volume with a soundTransform, but I can't seem to do anything with pan and I think it is because I am lacking the knowledge concern creating a soundChannel to control a live webcam stream:


Code:

inStream1 = new NetStream(client_nc);

incomingVid1.attachNetStream(inStream1);

trans1 = new SoundTransform();

trans1.volume = .5;

trans1.pan = -1; //doesn't work

inStream1.soundTransform = trans1;

inStream1.play(video1);





inStream2 = new NetStream(client_nc);

incomingVid2.attachNetStream(inStream2);

trans2 = new SoundTransform();

trans2.volume = .5;

trans2.pan = 1; //doesn't work

inStream2.soundTransform = trans2;

inStream2.play(video2);
Thank you for your time and energy!

Nate

Multi-core Video With Alpha Channels
I'm currently working on a video project which includes projecting fairly high res video (1366x683) using flash.
At first we tried it with a regular FLV, but we ran into the problem that that only uses 1 core of our Multi-core PC.
So after a little bit of searching we found out that we had to use another video format and we came across the H264 codec which according to our research supports multi-core usage. (Havent had time to test it out at this time)
But now our problem is that that format doesn't support Alpha channels which is also required.
So the question now is; What video format to use?





























Edited: 11/04/2008 at 01:25:42 AM by TaoHunter

Sound Channels And Live Video Feeds
Hello All,

I spent the better part of the afternoon researching this one and have come up empty handed. The app I am designing displays two live webcam streams from an FMS. What I want to do is control the audio from each stream so that camera1's audio plays in the left speaker only and camera2's audio plays in the right speaker only. I know this is done via soundchannels and soundTransforms, but how do you associate a soundChannel with the audio from a live webcam stream? All of the documentation I have read illustrates how to associate a soundChannel with a static mp3 file. ie:

[code]

sc = s.play();

[/code]

The following code is what I am working with thus far. All I have been able to do is successfully control the volume with a soundTransform, but I can't seem to do anything with pan and I think it is because I am lacking the knowledge concern creating a soundChannel to control a live webcam stream:

[code]

inStream1 = new NetStream(client_nc);

incomingVid1.attachNetStream(inStream1);

trans1 = new SoundTransform();

trans1.volume = .5;

trans1.pan = -1; //doesn't work

inStream1.soundTransform = trans1;

inStream1.play(video1);





inStream2 = new NetStream(client_nc);

incomingVid2.attachNetStream(inStream2);

trans2 = new SoundTransform();

trans2.volume = .5;

trans2.pan = 1; //doesn't work

inStream2.soundTransform = trans2;

inStream2.play(video2);

[/code]

Thank you for your time and energy!

Nate

Sound Channels And Live Video Feeds
Hello All,
I spent the better part of the afternoon researching this one and have come up empty handed. The app I am designing displays two live webcam streams from an FMS. What I want to do is control the audio from each stream so that camera1's audio plays in the left speaker only and camera2's audio plays in the right speaker only. I know this is done via soundchannels and soundTransforms, but how do you associate a soundChannel with the audio from a live webcam stream? All of the documentation I have read illustrates how to associate a soundChannel with a static mp3 file. ie:

Code:
sc = s.play();
The following code is what I am working with thus far. All I have been able to do is successfully control the volume with a soundTransform, but I can't seem to do anything with pan and I think it is because I am lacking the knowledge concern creating a soundChannel to control a live webcam stream:

Code:
inStream1 = new NetStream(client_nc);
incomingVid1.attachNetStream(inStream1);
trans1 = new SoundTransform();
trans1.volume = .5;
trans1.pan = -1; //doesn't work
inStream1.soundTransform = trans1;
inStream1.play(video1);


inStream2 = new NetStream(client_nc);
incomingVid2.attachNetStream(inStream2);
trans2 = new SoundTransform();
trans2.volume = .5;
trans2.pan = 1; //doesn't work
inStream2.soundTransform = trans2;
inStream2.play(video2);
Thank you for your time and energy!
Nate

Any IRC Flash Channels, Or Chat Channels?
Hi,

just wondering if anyone know of any Flash devoted chat channels, either through IRC or some other method. I used to frequent some 3d modeling IRC channels in the past that were very helpful to me and likewise I'd like to check out any Flash chat channels.

Thanks in advance.

Perlinnoise Dynamic Channels
Hi,

I'm applying the Perlinnoise filter to a bitmap. This works fine but I would like to change the channel property dynamicly as the same bitmap is used for different things.
This is the array with channels:
var ground_channel:Array = [0, 2, 0, 0, 2, 0, 0];
This is the noise filter:

PHP Code:




function make_ground(xbase:int, ybase:int, channel:uint, grey:Boolean):void
{
    ground_bmd.perlinNoise(xbase, ybase, 6, seed, false, true, channel|8, grey, null);
    addChild(ground_bm);
    trace(typeof channel); // number
}






As you can see I want the channel to be always transparent (alpha is on: 8) but I want the colours to change. I've tried different ways of storing the channels in the array and getting it out.
In the array 2|8 and just the channel var in the function. I've also tried adding channel+|8 but this gave a syntax error.
So I keep getting only black and white noise. The grey value for greyscale is set to false by the way

Hope someone can help me and tell me how I can make dynamic channels work.
Thanks a lot in advance.

XML Video Playlist: Cannot Get 2nd Video To Play Upon Click
Hey guys. I did the video tutorials exactly as indicated on the site here but I cannot seem to get the second video to play once I click on that item in the video list. There are not action script errors. I have attached my action script and the .xml file. Any help would be greatly appreciated since I'm trying to meet a deadline. Thanks.

Here is my action script code:
Code:

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(3);
ns.onStatus = function(info) {
   if (info.code == "NetStream.Buffer.Full") {
      bufferClip._visible = false;
   }
   if (info.code == "NetStream.Buffer.Empty") {
   }
   if (info.code == "NetStream.Play.Stop") {
      ns.seek(0);
   }
};
theVideo.attachVideo(ns);
rewindButton.onRelease = function() {
   ns.seek(0);
};
playButton.onRelease = function() {
   ns.pause();
};
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function (obj) {
   duration = obj.duration;
};
function videoStatus() {
   amountLoaded = ns.bytesLoaded/ns.bytesTotal;
   loader.loadbar._width = amountLoaded*137.5;
   loader.scrub._x = ns.time/duration*137.5;
}
var scrubInterval;
loader.scrub.onPress = function() {
   clearInterval(videoInterval);
   scrubInterval = setInterval(scrubit, 10);
   this.startDrag(false, -7, this._y, 128, this._y);
};
loader.scrub.onRelease = loader.scrub.onReleaseOutside=function () {
   clearInterval(scrubInterval);
   videoInterval = setInterval(videoStatus, 100);
   this.stopDrag();
};
function scrubit() {
   ns.seek(Math.floor((leader.scrub._x/128)*duration));
}
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
//new menu
var i1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::", trace);
theMenu.customItems[0] = i1;
var i2:ContextMenuItem = new ContextMenuItem("Play / Pause Video", pauseIt, true);
theMenu.customItems[1] = i2;
var i3:ContextMenuItem = new ContextMenuItem("Replay Video", replayIt);
theMenu.customItems[2] = i3;
var i4:ContextMenuItem = new ContextMenuItem("Copyright Brevard Public Schools", trace);
theMenu.customItems[3] = i4;
function pauseIt() {
   ns.pause();
}
function replayIt() {
   ns.seek(0);
}
_root.createEmptyMovieClip("vSound", _root.getNextHightstDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute.onRollover = function() {
   if (so.getVolume() == 100) {
      this.gotoAndStop("onOver");
   } else {
      this.gotoAndStop("muteOver");
   }
};
mute.onOut = function() {
   if (so.getVolume() == 100) {
      this.gotoAndStop("on");
   } else {
      this.gotoAndStop("mute");
   }
};
mute.onRelease = function() {
   if (so.getVolume() == 100) {
      so.setVolume(0);
      this.gotoAndStop("muteOver");
   } else {
      so.setVolume(100);
      this.gotoAndStop("onOver");
   }
};
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.selectedIndex).data);
};
videoList.addEventListener("change", vidList);
vlist.load("videos.xml");


here is my videos.xml file
Code:

<?xml version ="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="vid1.flv" desc="Introduction" />
<video url="05intro.flv" desc="Interviews" />
<video url="vid1.flv" desc="Employee of the Year" />
<video url="vid1.flv" desc="Assistant Superintendent" />
</videos>[/code]

XML Video Playlist Tutorial (Video Not Showing)
hmmm, a little problem. I followed the tutorial, and when testing my movie I only get sound from the video but no picture. Playing the flv's on their own in my flv player work fine. Any Suggestions?

Code:

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(30);

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);
   }
}

rewindButton.onRelease = function() {
   ns.seek(0);
}

playButton.onRelease = function() {
   ns.pause();
}

var videoInterval = setInterval (videoStatus,100);
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
   duration = obj.duration;
}

function videoStatus() {
   amountLoaded = ns.bytesLoaded / ns.bytesTotal;
   loader.loadbar._width = amountLoaded * 236;
   loader.scrub._x = ns.time / duration * 236;
}

var scrubInterval;

loader.scrub.onPress = function() {
   clearInterval(videoInterval);
   scrubInterval = setInterval(scrubit,10);
   this.startDrag(false,0,this._y,229,this._y);
}

loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
   clearInterval(scrubInterval);
   videoInterval = setInterval (videoStatus,100);
   this.stopDrag();
}

function scrubit() {
   ns.seek(Math.floor((loader.scrub._x/229)*duration));
}

function pauseIt() {
   ns.pause();
}

function replayIt() {
   ns.seek(0);
}

_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);

var so:Sound = new Sound(vSound);

so.setVolume(100);

mute.onRollOver = function() {
   if(so.getVolume() == 100) {
      this.gotoAndStop("onOver");
   }
   else {
      this.gotoAndStop("muteOver");
   }
}

mute.onRollOut = function() {
   if(so.getVolume() == 100) {
      this.gotoAndStop("on");
   }
   else {
      this.gotoAndStop("mute");
   }
}

mute.onRelease = function() {
   if(so.getVolume() == 100) {
      so.setVolume(0);
      this.gotoAndStop("muteOver");
   }
   else {
      so.setVolume(100);
      this.gotoAndStop("onOver");
   }
}

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.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vList.load("video.xml");

Html Text And Alpha Channels One A Dynamic Box
Is it possible to have html formatted text in a dynamic text box, that has an alpha value that is less then 100?

It seems that i am able to fade the box if the fonts are embedded, BUT if i do this, i cannot successfullly format the text!

Thanks in advance!

Video Playlist - Next Video (FLV Files)
I am trying to create a simple playlist.

Once an external FLV file finishes playing, I would like to automatically load the next external FLV file. The only way I can do this currently is by placing Next and Prev buttons to make the user navigate from video to video, but this option is not automatic. Any ideas?

On a more complicated note... I am trying to create an XML driven Video Playlist. (For examples see AOL's top 11 http://music.aol.com/top11/ or MTV's Overdrive http://www.mtv.com/overdrive/).

Thanks!

XML Video Playlist
hey, i was following the video series with the xml playlist and i got stuck. my xml looks like

<videos>
<video url="www.something.com/t.flv" desc="the titles of video" about=" description of the video" />
.....then repeated for all videos
</videos>

i have it on subydude.com/video working but with no description. i did however get it to show the description when you click on a title in the list component, but the video wont play. here is my code for the flash (part of it) hopefully someone can tell me what i em doing wrong. i no that the ns.play is trying to call the ".data" of the list component, so i took out the attributes.url to get my description to come up, but now i need another way for the ns.play to see the url to all my videos so i can have people click a titles - start the video - and get a description in a text box.

var vlist:XML = new XML();
vlist.ignoreWhite = true;
vlist.load("videos.xml");

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.about);
//videos[i].attributes.url,//
}
ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
textbox.text = (videoList.getItemAt(0).data);
}

var vidList:Object = new Object();
vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
textbox.text = textbox.text = (videoList.getItemAt(videoList.selectedIndex).data );
}
videoList.addEventListener("change",vidList);

videoList.setStyle("selectionColor",0xCCCCCC);
videoList.setStyle("textSelectedColor",0x000000);
videoList.setStyle("rollOverColor",0xCCCCCC);



http://subydude.com/jared/video.html <---what i want (so close!!)
http://subydude.com/video <----what it is now

XML Video Playlist Help
Hello everyone,

I having a little trouble trying to expand upon the XML video playlist created by Lisa Larson on the Flash Developer Center. You can see the tutorial I'm referring to here:
BTW, the sample link on the tutorial page appears to be broken, so I've posted a sample of the finished piece here.

Anyways, I'd like to add another dynamic element to this application... When a user clicks on an item in the list, I'd like a link/button (URL to be determined in the external XML file) to appear on the stage along with the selected video. I'd also love to be able to add a text description about the video file, but the link is priority numero uno.

I've attempted to decipher the actionscript from the tutorial several times, as well as slaving over several other similar tutorials, but I'm not having any luck... I'm hoping someone here might have tried something similar and had better results than myself. Any help is greatly appreciated!

BTW, here's the relevant AS:

Code:
//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
var nav = list.dataProvider[list.selectedIndex];
nc = new NetConnection(); //create a connection
nc.connect( null );//null connection for progressive download
ns = new NetStream(nc); //create a stream
video.attachVideo(ns); //pipe stream to this video object
// walk through the chosen item, build and play it
var reset = true;
for ( var i = 0; i < nav.childNodes.length; i++ ) {
var stream = nav.childNodes[i];
if ( stream.nodeName == "stream" ) {
// build path to flv, and play it
myStreamPath = nav.attributes.url + "/" + stream.attributes.name;
ns.setBufferTime(10);
ns.play( myStreamPath);
reset = false;
}
}
}

//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);


//Function that loads the XML file, parses it, and builds the list of available video clips
var xmllist = new XML(); //setup a variable to hold the XML
xmllist.ignoreWhite = true;
xmllist.load( "playlist-demo-1.xml" ); //load the XML file
//The following gets called when the XML has been loaded
xmllist.onLoad = function( status ) {
if ( !status )
trace( status );
var entries = this.childNodes[0];
var playlists = {};
var nav = [];
for ( var i = 0; i < entries.childNodes.length; i++ ) {
var entry = entries.childNodes[i];
if ( entry.nodeName == "listitem" )
//builds array of video clip names
playlists[entry.attributes.name] = entry;
else if ( entry.nodeName == "menu" ) {
//builds array of available videos
for ( var j = 0; j < entry.childNodes.length; j++ )
nav[j] = playlists[entry.childNodes[j].attributes.name];
} //end else if
} //end if

//sends the array of videos to the listbox UI
list.dataProvider = nav;
} //end xmllist.onload
Thanks again!
~Ryan

XML Video Playlist HELP
Hello

I followed Lee Brimelow's flv tutorial on creating an xml video playlist. I have 7 videos on the xml playlist that I would like the user to choose from, but when tested the only video that loads and regardless of what video that is chosen on the playlist, video 2 is the only video that plays. I am new to this style of actionscript (hence the tutorial) so if anyone could help me or point me in the right direction, that would be great.

Here is my actionscript: (All From Lee Brimelow's Tutorials (XML and Video Basics)


Code:
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[1].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");
here is my XML:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
<video url="http://mydomain.com/flv/video_1.flv" desc="video_1" />
<video url="http://mydomain.com/flv/video_2.flv" desc="video_2" />
<video url="http://mydomain.com/flv/video_3.flv" desc="video_3" />
<video url="http://mydomain.com/flv/video_4.flv" desc="video_4" />
<video url="http://mydomain.com/flv/video_5.flv" desc="video_5" />
<video url="http://mydomain.com/flv/video_6.flv" desc="video_6" />
<video url="http://mydomain.com/flv/video_7.flv" desc="video_7" />
</videos>
THANKS

Lee's XML Video Playlist In AS3.0
Hello all,
First off big ups to Lee for the video tutorial which can be found here. I'm trying to convert the program to AS3.0 and am having the hardest of time. I managed to convert some pieces of it.

But still getting this error.

Code:
[TypeError: Error #1010: A term is undefined and has no properties.
at videoplayer_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Here is the coding so far:

Code:
//Creates an xml object
var vlist:XML = new XML();

var XML_URL:String = "videos.xml";
var vlistURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(vlistURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(evtObj:Event)
{
//test is data is executing
vlist = XML(myLoader.data);
trace(vlist);

var videos:Array = this.firstChild.childNodes;
//loop through all the items in the xml
for(var i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);

}

//tell xml to ignore whitespaces (always do this!)
vlist.ignoreWhitespace = true;

flvPlayback.play(videoList.getItemAt(0).data);

videoList.selectedIndex = 0;

}

var vidList:Object = new Object();

function changeHandler(event:Event):void {
flvPlayback.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener(Event.CHANGE, changeHandler);
I know that the portion is AS2.0, can anyone help me convert it to 3.0? Spent nearing 5 hours on it .

Code:
var videos:Array = this.firstChild.childNodes;
//loop through all the items in the xml
for(var i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
Before I forget, here is my xml file as well. If it helps :|

videos.xml

Code:
<?xml versdion="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="videos/vid1.flv" desc="New years eve party" />
<video url="videos/vid2.flv" desc="DAv retirement" />
</videos>
Thanks!

-late

XML: Video Playlist
Hey I am a little new to AS3 and need a little help with getting videos to play correctly.

Basically I started with an XML image gallery and tweaked it a little bit to load videos instead of images. AS3 loads in thumbnails which once clicked load a video. The videos do in fact play, however they are never unloaded. So when you click on multiple thumbs, the videos begin to play on top of one another. I am also noticing sometimes the videos will not play all the way through. Any help would be appreciated. Thanks.


ActionScript Code:
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
var video:Video = new Video(440, 330);
video.attachNetStream(videoStream);

var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("data/videos.xml"));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void {
    xml = XML(event.target.data);
    xmlList = xml.children();
    for(var i:int = 0; i < xmlList.length(); i++)
    {
        imageLoader = new Loader();
        imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
        imageLoader.y = 300;
        imageLoader.x = 90 * i + 30;
        imageLoader.name = xmlList[i].attribute("source");
        addChild(imageLoader);
        imageLoader.addEventListener(MouseEvent.CLICK, loadVid);
    }
}

function loadVid(event:MouseEvent):void
{
    videoStream.play(event.target.name);
    addChild(video);
}

XML Video Playlist Help
I am trying to create a dynamic playlist for my custom flv player. I went through several different tutorials but I am having a hard time getting all the pieces to fit together. The player works, and it loads the xml file, but nothing else happens. I know I am missing some key links here. I don't use components, so I am trying to make this list from scratch, any help would be greatly appreciated.

Hers is my actionscript


ActionScript Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(10);

ns.onStatus = function(info) {
    if (info.code == "NetStream.Buffer.Full") {
        player.bufferClip._visible = false;
    }
    if (info.code == "NetStream.Buffer.Empty") {
        player.bufferClip._visible = true;
    }
    if (info.code == "NetStream.Play.Stop") {
        ns.pause();
    }
};

player.theVideo.attachVideo(ns);

var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(pf08_ns:NetStream) {
var ns_seconds:Number = pf08_ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60)
if (seconds<10) {
seconds = ("0"+seconds);
}
player.time_txt.text = minutes+":"+seconds+"/";
};

ns.onMetaData = function(metadata) {
    duration = metadata.duration;
    var dur_seconds:Number = duration;
    var minutes_dspl = Math.floor(dur_seconds/60);
    var seconds_dspl = Math.floor(dur_seconds%60);
    if (minutes_dspl<10) {
        minutes_dspl = ("0"+minutes_dspl);
    }
    if (seconds_dspl<10) {
        seconds_dspl = ("0"+seconds_dspl);
    }
    player.duration_txt.text = minutes_dspl+":"+seconds_dspl;
};

player.playBtn.onRollOver = function() {
    this.gotoAndPlay("Over");
};
player.playBtn.onRollOut = function() {
    this.gotoAndPlay("Out");
};
player.playBtn.onRelease = function() {
    ns.pause();
};

player.rewindBtn.onRollOver = function() {
    this.gotoAndPlay("Over");
};
player.rewindBtn.onRollOut = function() {
    this.gotoAndPlay("Out");
};
player.rewindBtn.onRelease = function() {
    ns.play("sta01.flv");
}
_root.createEmptyMovieClip("vSound", _.root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
player.muteBtn.onRollOver = function() {
    if (so.getVolume() == 100) {
        this.gotoAndStop("onOver");
    } else {
        this.gotoAndStop("muteOver");
    }
};
player.muteBtn.onRollOut = function() {
    if (so.getVolume() == 100) {
        this.gotoAndStop("on");
    } else {
        this.gotoAndStop("mute");
    }
};
player.muteBtn.onRelease = function() {
    if (so.getVolume() == 100) {
        so.setVolume(0);
        this.gotoAndStop("muteOver");
    } else {
        so.setVolume(100);
        this.gotoAndStop("onOver");
    }
};

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.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");

Video Playlist
iam getting some problems in video playlist.
plz check this link http://www.chiefexecutive.net/newsletter/videos4/video.html in thz link there is a video playlist is coming. in the playlist one "more" button is there. that more button Event is not working.

XML Video Playlist
HI,

I'm trying to make an XML video playlist and I'm getting the following error:

1000: Unable to make connection to server or to find FLV on server

The XML file, swf and videos are all in the same directory and I've checked the names to make sure.

The swf is reading the XML file fine, the descriptions from the file are showing up in the list box which is named "videoList"

here's the code:

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.attributes.desc,videos.attributes.url);
}

ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function () {
ns.play(videoList.getItemAt (videoList.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");


Here's the XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
<video url="video1.flv" desc="Background to the Standards"/>
<video url="video2.flv" desc="The Role of the Standards"/>
<video url="video3.flv" desc="The Information and Advice Process"/>
</videos>

Hope someone can help, probably a school boy error.

Cheers,
Malcolm

XML Video Playlist
I've created an XML video playlist like the one shown in this tutorial:
http://www.adobe.com/devnet/flash/articles/prog_download.html

I was wondering how I could edit it to autoplay the first item in the list upon loading, but still have the list be completely functional. I've tried everything I can think of, but can't get it to autoplay and still work.

Thanks!

Xml Video Playlist
Hi,

I've been looking for a tutorial to make an XML video playlist, where the user clicks on a thumbnail and a video is loaded in via XML (kind of like youtube). Does anyone know of any good tutorials for this, i've been looking for ages but cant find any...i've checked the adobe site, found one but to be honest i dont understand the script (i dont want to just copy paste..)..

Any help would be great...

Ben.

Xml Video Playlist
Ok, here it goes. I have a flash video player whose playlist is based off an xml list. Now, I need this list to change based on whose accesing the player. So:

Client gets a link, clicks on link, player shows their video. Another client clicks on another link, player shows their video, etc etc.

Video Playlist
I completed the tutorial located here http://www.adobe.com/devnet/flash/articles/video_playlist.html

But now i want a playlist seperated from the video. For instance: having muliple thumnails and discriptions that are links and then when one is clicked, the main player opens in a new window.

can someone help please. maybe shoot me a tutorial or something

I want to achieve somthing like this http://www.cbsnews.com/sections/60minutes/main3415.shtml

If you click on the thumbnail it opens a new window and plays that video..

Thanks in advance.







Attach Code

package {
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import fl.controls.listClasses.CellRenderer;
import fl.controls.ScrollBarDirection;

public class VideoPlaylist extends MovieClip {
private var xmlLoader:URLLoader;

public function VideoPlaylist():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(200, 240);
tileList.columnWidth = 180;
tileList.rowHeight = 60;
tileList.direction = ScrollBarDirection.VERTICAL;
tileList.setStyle("cellRenderer", Thumb);
}

public function initMediaPlayer(event:Event):void {
var myXML:XML = new XML(xmlLoader.data);
var item:XML;
for each(item in myXML.vid) { // populate playlist.
// Get thumbnail value and assign to cellrenderer.
var thumb:String;
if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
// Send data to tileList.
tileList.addItem({label:item.attribute("desc").toXMLString(),
data:item.attribute("src").toXMLString(),
source:thumb});;
}
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into myVid.
myVid.source = tileList.selectedItem.data;
// Pause video until selected or played.
myVid.pause();
}


// Detect when new video is selected, and play it
function listListener(event:Event):void {
myVid.play(event.target.selectedItem.data);
}


}
}

























Edited: 05/19/2008 at 05:31:37 PM by designedfree4u

Video PlayList
Hi all,

This will probably be easy for someone who has experienced this... I did the dynamic video playlist tutorial on the site: http://www.adobe.com/devnet/flash/articles/video_player.html. It works fine on the swf but when I publish and HTML page - the page only loads the tileList but the FLV playback video doesn't even appear. Not even when I click on a selection from the tileList - what am I doing wrong?

Thanks,
Ms.Lee

Video Playlist...
I've got a bunch of flvs that are streaming (net stream) upon clicking on a link (1 - 10)... I'm trying to design it where, no matter what number you click on, it plays the following videos in sequence.

Click on Video 1 - when Video 1 finishes, it streams and then plays Video 2, then 3, 4, 5, etc.

Click on Video 5 - when Video 5 finished, it streams and then plays Video 6, 7, 8, 9, etc.

Thanks in advance!

XML Video Playlist
Hi,

I followed a tutorial on making a video playlist in Flash using XML. it's giving me the following error : "1000: Unable to make connection to server or to find FLV on server"

I know what you're thinking, but I've triple checked the file locations and it's all in the right place. A trace command is returning the correct file too.

I have a one frame swf, a video component and a list box - with the instance name "videoList"- on the stage.

NOTE: I'm running this from my hard drive, it's going to be put on CD.
I have also tried putting a URL to an online flv file in the XML.

The following code is on frame 1:


Quote:




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.selectedIndex).data);
}
videoList.addEventListener("change",vidList);
vlist.load("videos.xml");




here's what's in the XML file:


Quote:




<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
<video url="video1.flv" desc="Background to the Standards"/>
<video url="video2.flv" desc="The Role of the Standards"/>
<video url="video3.flv" desc="The Information and Advice Process"/>
</videos>

XML Video Playlist
I made a video play list using XML file but now i want to know is it possible to make a video play list in which i can change my video by clicking on different images ?

like I have 10 or less than images in my flash page and I change my video every time by clicking on these images .

If it is possible then please tell me about any reference or tutorial.

If any body can ?

Thanks in advance.

XML: Video Playlist
Hey I am a little new to AS3 and need a little help with getting videos to play correctly.

Basically I started with an XML image gallery and tweaked it a little bit to load videos instead of images. AS3 loads in thumbnails which once clicked load a video. The videos do in fact play, however they are never unloaded. So when you click on multiple thumbs, the videos begin to play on top of one another. I am also noticing sometimes the videos will not play all the way through. Any help would be appreciated. Thanks.

Code:

var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
var video:Video = new Video(440, 330);
video.attachNetStream(videoStream);

var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("data/videos.xml"));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void {
   xml = XML(event.target.data);
   xmlList = xml.children();
   for(var i:int = 0; i < xmlList.length(); i++)
   {
      imageLoader = new Loader();
      imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
      imageLoader.y = 300;
      imageLoader.x = 90 * i + 30;
      imageLoader.name = xmlList[i].attribute("source");
      addChild(imageLoader);
      imageLoader.addEventListener(MouseEvent.CLICK, loadVid);
   }
}

function loadVid(event:MouseEvent):void
{
   videoStream.play(event.target.name);
   addChild(video);
}

Lee's XML Video Playlist In AS3.0
Hello all,
First off big ups to Lee for the video tutorial. I'm trying to convert it the program to AS3.0 and am having the hardest of time. I managed to convert some pieces of it. But still getting this error.

TypeError: Error #1010: A term is undefined and has no properties.
at videoplayer_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Heres the coding so far.
Code:

//Creates an xml object
var vlist:XML = new XML();

var XML_URL:String = "videos.xml";
var vlistURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(vlistURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(evtObj:Event)
{
   //test is data is executing
vlist = XML(myLoader.data);
    trace(vlist);

   var videos:Array = this.firstChild.childNodes;
   //loop through all the items in the xml
   for(var i=0;i<videos.length;i++) {
      videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
   
}

//tell xml to ignore whitespaces (always do this!)
vlist.ignoreWhitespace = true;

flvPlayback.play(videoList.getItemAt(0).data);

videoList.selectedIndex = 0;

}

var vidList:Object = new Object();

function changeHandler(event:Event):void {
flvPlayback.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener(Event.CHANGE, changeHandler);


I know that the portion
Code:

   
var videos:Array = this.firstChild.childNodes;
   //loop through all the items in the xml
   for(var i=0;i<videos.length;i++) {
      videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);


is AS2.0, can anyone help me convert it to 3.0? Spent nearing 5 hours on it . I really need to get a book haha!

Before I forget, here is my xml file as well. If it helps
videos.xml
Code:

<?xml versdion="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="videos/vid1.flv" desc="New years eve party" />
<video url="videos/vid2.flv" desc="DAv retirement" />
</videos>


Thanks!

-late

Xml Video Playlist Help
Code:

okay i don't have any idea why this isn't working...i followed exactly over lee brimelows basic video tutorials, and i followed his xml video playlist tutorial, i've checked over it multiple times and watch the video many times, but i still cannot find the reason why my video's will not show up on the side...
i'll post my actionscript here to see if anyone can find the error, please help!

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns=NetStream = new NetStream(nc);

ns.setBufferTime(10);

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);




rewindButton.onRelease = function() {
   ns.seek(0);
}

playButton.onRelease = function() {
   ns.pause();
}

var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
   duration = obj.duration;
}

function videoStatus() {
   amountLoaded = ns.bytesLoaded / ns.bytesTotal;
   loader.loadbar._width = amountLoaded * 171.4;
   loader.scrub._x = ns.time / duration * 171.4;
}

var scrubInterval;

loader.scrub.onPress = function() {
   clearInterval(videoInterval);
   scrubInterval = setInterval(scrubit,10);
   this.startDrag(false,-4.3,this._y,164,this._y);
}

loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
   clearInterval(scrubInterval);
   videoInterval = setInterval(videoStatus,100);
   this.stopDrag();
}

function scrubit() {
   ns.seek(Math.floor((loader.scrub._x/164)*duration));
}


var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;

var i1:ContextMenuItem = new ContextMenuItem(":':': IM Video Controls :':':",trace);
theMenu.customItems[0] = i1;

var i2:ContextMenuItem = new ContextMenuItem("Play / Pause",pauseIt,true);
theMenu.customItems[1] = i2;

var i3:ContextMenuItem = new ContextMenuItem("Replay Video",replayIt);
theMenu.customItems[2] = i3;

var i4:ContextMenuItem = new ContextMenuItem("Copyright 2007-2008 Ironic Mayhem",trace,true);
theMenu.customItems[3] = i4;

function pauseIt() {
   ns.pause();
}

function replayIt() {
   ns.seek(0);
}


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.selectedIndex).data);
}
videoList.addEventListener("change",vidList);

vidList.load("http://sluggo928.googlepages.com/videoplaylist.xml");

Video Playlist
I completed the tutorial located here http://www.adobe.com/devnet/flash/artic ... ylist.html

But now i want a playlist seperated from the video. For instance: having muliple thumbnails and discriptions that are links and then when one is clicked, the main player opens in a new window.

can someone help please. maybe shoot me a tutorial or something?

Thanks in advance.

Code i have so far
Code:

package {
   import flash.display.MovieClip;
   import flash.net.URLLoader;
   import flash.net.URLRequest;
   import flash.events.Event;
   import fl.controls.listClasses.CellRenderer;
   import fl.controls.ScrollBarDirection;

   public class VideoPlaylist extends MovieClip {
      private var xmlLoader:URLLoader;
      
      public function VideoPlaylist():void {
         // Load the playlist file, then initialize the media player.
         xmlLoader = new URLLoader();
         xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
         xmlLoader.load(new URLRequest("playlist.xml"));
         // Format the tileList, specify its cellRenderer class.
         tileList.setSize(200, 240);
         tileList.columnWidth = 180;
         tileList.rowHeight = 60;
         tileList.direction = ScrollBarDirection.VERTICAL;
         tileList.setStyle("cellRenderer", Thumb);
      }
      
      public function initMediaPlayer(event:Event):void {
         var myXML:XML = new XML(xmlLoader.data);
         var item:XML;
         for each(item in myXML.vid) { // populate playlist.
            // Get thumbnail value and assign to cellrenderer.
            var thumb:String;
            if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
            // Send data to tileList.
            tileList.addItem({label:item.attribute("desc").toXMLString(),
            data:item.attribute("src").toXMLString(),
            source:thumb});;
         }
         // Select the first video.
         tileList.selectedIndex = 0;
         // Listen for item selection.
         tileList.addEventListener(Event.CHANGE, listListener);
         // And automatically load it into myVid.
         myVid.source = tileList.selectedItem.data;
         // Pause video until selected or played.
         myVid.pause();
      }

      
      // Detect when new video is selected, and play it
      function listListener(event:Event):void {
         myVid.play(event.target.selectedItem.data);
      }
      
      
   }
}


I want to achieve somthing like this http://www.cbsnews.com/sections/60minut ... 3415.shtml If you click on the thumbnail it opens a new window and plays that video..

XML Video PlayList
I created a 2 buttons that load a different xml playlist in the list component, but when you click on the second button it just loads it in the list without clearing the list.

coding:
videoList.addEventListener("change",vidList);

ep1btn.onRelease = function() {
vlist.load("videos.xml");
}

ep2btn.onRelease = function() {
vlist.load('videos2.xml');
}

Is there a coding that clears the previous list?

Thanks

XML VIDEO PLAYLIST
Hello, i am fairly new to these forums, im having problems with lee`s tutorial on his xml playlist. Is there any way some who has it could post up the fla or something? :roll:

This would help me out so much,
Thanks for your time
Nathan

XML Video Playlist
Ive followed the tut. for the xml video playlist and all is working but I wanted to know how to stop the flv looping.

At the moment, once a video is completed it loops. I want it just to stop. I assume this is a small piece of AS but I cant figure it out.

Can anyone help :?:

Thank you in advance.

Mitesh

Video Playlist Help
Hi all.
I have been using the XML video playlist, and wanted to add thumbnails. I tried Todd's modification, but couldn't get it to display correctly.

I then tried to modify the playlist from Adobe - videosourcepro.
I am almost there... I just can't get the video duration to display properly in a dynamic text field. I took the code from my working fla (without the thumbnails) and applied it to the videosoucepro actionscript, but that did not work. I have also tried the timecode.as from Lee's bog, and couldn't get it to work either.

Any suggestions?

The current code:
Code:

//Set up the list box, call function VideoThumb to create the actual thumbnails

list.rowHeight = 70;
list.cellRenderer = "VideoThumb";
list.selectable = true;

//create new empty listener object
listListener = {};

//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
   var nav = list.dataProvider[list.selectedIndex];
   nc = new NetConnection();          //create a connection
   nc.connect( null );               //null connection for progressive download
   ns = new NetStream(nc);          //create a stream
   video.attachVideo(ns);             //pipe stream to this video object
   // walk through the chosen item, build and play it   
   var reset = true;
   for ( var i = 0; i < nav.childNodes.length; i++ ) {
      var stream = nav.childNodes[i];
      if ( stream.nodeName == "stream" ) {
         // build path to flv, and play it
         myStreamPath = nav.attributes.url + "/" + stream.attributes.name;
         ns.setBufferTime(10);
         ns.play( myStreamPath);
         reset = false;
      }
   }
}

//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);


//Function that loads the XML file, parses it, and builds the list of available video clips
   var xmllist = new XML();        //setup a variable to hold the XML
   xmllist.ignoreWhite = true;
   xmllist.load( "playlist-demo-1.xml" );    //load the XML file
   //The following gets called when the XML has been loaded
   xmllist.onLoad = function( status )  {
      if ( !status )
         trace( status );
      var entries = this.childNodes[0];
      var playlists = {};
      var nav = [];
      for ( var i = 0; i < entries.childNodes.length; i++ ) {
         var entry = entries.childNodes[i];
         if ( entry.nodeName == "listitem" )
            //builds array of video clip names
            playlists[entry.attributes.name] = entry;
         else if ( entry.nodeName == "menu" ) {
            //builds array of available videos
            for ( var j = 0; j < entry.childNodes.length; j++ )
            nav[j] = playlists[entry.childNodes[j].attributes.name];
         } //end else if
      } //end if

      //sends the array of videos to the listbox UI
      list.dataProvider = nav;
   } //end xmllist.onload


//load bar
var videoInterval = setInterval(videoStatus, 100);
var amountloaded:Number;

function videoStatus() {
   amountLoaded = ns.bytesLoaded / ns.bytesTotal;
   loader.loadbar._width = amountLoaded * 310.9;
}
//End Loadbar

// Duration Text
var vidDur:Number;//Duration of the FLV
ns["onMetaData"] = function(obj) {
     vidDur = obj.duration;
}
function checkTime(ns:NetStream,duration:TextField) {
    var ns_seconds:Number = ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60);
    var vidminutes:Number = Math.floor(vidDur/60);
    var vidseconds = Math.floor(vidDur%60);
    if (vidseconds<10) {
       vidseconds = "0"+vidseconds;
    }
    if (seconds<10) {
    seconds = "0"+seconds;
    }
    durText.text = minutes+":"+seconds+" / "+vidminutes+":"+vidseconds;
}
var time_interval:Number = setInterval(checkTime, 60, ns,duration);
//End Duration Text


//resizes the video object to the width and height of the clip
function onVideoResize() {
   if ( video.width != video._width || video.height != video._height ) {
      video._width = video.width;
      video._height = video.height;
      //center video in playback area
      newx = (460 - video._width)/2;
      newy = (470 - video._height)/2;
      video._x = newx;
      video._y = newy;
   }
}
setInterval( onVideoResize, 200 ); //keeps checking video size


Thumbnail code:

Code:


class VideoThumb extends mx.core.UIComponent
{
   static var symbolName = "VideoThumb";
   var label : Object;      // the new text label we'll use
   var listOwner : Object; // reference to the tree - supplied by the tree
   var thumb;
   var nc;               // NetConnection
   var ns;               // NetStream
   var streamurl;
   
   function VideoThumb()
   {
      // nothing needed - we're extending v2;
   }

   function init()
   {
      // nothing needed - we don't have any instance variables to initialize
   }

   function createChildren(Void) : Void
   {
      // attachMovie (linkageID, new name, depth)
      var v = this.attachMovie( "VideoHolder", "thumb", 0 );
      v._width = 80;
      v._height = 60;
      v.styleName = listOwner;

      var c = createLabel("label", 1);
      
      c.styleName = listOwner;
      c.selectable = false;
   }

   // pass all sizing from the tree to the cell
   function size(Void) : Void
   {
      label.setSize(label.getPreferredWidth(),label.getPreferredHeight());
      label._x = thumb._width + 10;
      label._y = thumb._height/2 - label._height/2;
   }

   // str is the suggested string to render from the tree (based on the node)
   // node is the entire XMLNode for the row
   // sel is the selected state (not usually used)
   function setValue(str : String, item, sel)
   {
      _visible = item != undefined;
      if ( !_visible )
         return;
      
      label.setValue( item.attributes.name );
      //trace(item.attributes.name);
      // Thumbnail is picked up as the first frame of the playlist
      var url = item.attributes.url;
      var stream = item.attributes.thumb;
      var start = item.attributes.thumbpos;
            
            //grab jpg thumbnail instead of initiating stream as shown commented out above.
      var newClip = this.createEmptyMovieClip("thumbie",this.getNextHighestDepth());
      newClip.loadMovie("thumbs/"+stream);
      
      // If explicit thumb is not specified use the
      // start frame of the first stream
      if ( stream == undefined ) {
         stream = item.childNodes[0].attributes.name;
         start = item.childNodes[0].attributes.start;
      }
      
      // Give up if we still don't have valid thumb info
      if ( stream == undefined )
         return;

      // Render the thumbnail only if necessary
      if ( streamurl == url + "/" + stream )
         return;
      
      streamurl = url + "/" + stream;
      //trace( streamurl );
      trace( stream );
      
      //nc = new NetConnection();
//nc.onStatus = function( info ) { trace( info.code ); }
      //nc.connect( null );
      
      //ns = new NetStream(nc);
      //ns.onStatus = function(info) {
         //if ( info.code == "NetStream.Play.Stop" ) {
            //nc = null;
            //ns = null;
         //}
      //}
      //ns.connect();
      //ns.play( stream, start, 0 );
      //ns.play( streamurl );
      //ns.seek(2);
      //ns.pause();
      

   }

   // ensures the cell is centered vertically properly - luckily, the label also implements this method.
   function getPreferredHeight()
   {
      return 60;
   }

   function getPreferredWidth()
   {
      return label.getPreferredWidth();
   }
}


Jay

Copyright © 2005-08 www.BigResource.com, All rights reserved