PDA

View Full Version : multiple FLV one player


BluegillMedia
06-14-2006, 04:11 PM
Sorry, this might be a really basic question but I can't seem to find the answer with my searches.

How do I tell my video component to load different FLVs?
(I want to have a menu that will tell the player which video to play).

Is there a way to do this all on one frame of do i have to create a different frame with a player with a different video in it (which is what I typically have done but figured there must be a better way).

Is this possible in both flash 7 and flash 8?

guitarman5000
06-14-2006, 04:23 PM
i don't really know much about components, but i do know that they can be hard to modify and control. what i do know is that if you make your own interface (which isn't as hard as it may seem) i think it would be easier to use multiple videos. in fact, there's a really really good series of video tutorials at gotoAndLearn.com (http://www.gotoandlearn.com). if you follow those tutorials, i think once you get started you'll be able to modify it to load movies based on the click of a button as opposed to just automatically loading a movie when the swf loads.

BluegillMedia
06-14-2006, 09:13 PM
So it take it the secret is to not use the component?

Mazoonist
06-15-2006, 12:59 AM
Create a new flash file. Drag an instance of the FLVPlayback component onto the stage. Give it an instance name. I chose "myPlayer" for a name. Now all you have to do is create a couple of buttons, one for each video you want to load. For simplicity's sake, I'll give them instance names of video1_btn and video2_btn. You'll have to make sure there's a couple of corresponding FLV files in the same folder as your app. Make sure you save the app to that same folder, also, as it won't work if it's just "untitled1" or whatever.

Create an actions layer on the main timeline, click on frame 1, press F9, enter the following code:

video1_btn.onRelease = function() {
myPlayer.contentPath = "first_video_filename.FLV";
}
video2_btn.onRelease = function() {
myPlayer.contentPath = "second_video_filename.FLV";
}

So if you think the secret is to not use components, I beg to differ. The above is really simple, no? And it worked fine for me. Give it a try.

jathomas
06-18-2006, 09:13 PM
I'm also using a FLVPlayBack component, and this solution works for me, thanks!!!

The only problem is, I'm trying to load different FLV's by having the user click on thumbnails that are in a scroller. Once I nest the thumbnails into another movie clip, this code doesn't work anymore. What can I do?

Mazoonist
06-19-2006, 12:02 AM
Hey, JA,

When you've got movie clips that are nested, just the name of the object won't do as a reference anymore; you've got to specify a path to it as well. There are two types of target paths: absolute and relative. In other words, either

this._parent.myPlayer.contentPath = "filename.FLV";

OR

_root.myPlayer.contentPath = "fileName.FLV";

The first is a relative path, the second is an absolute one. Either one should work okay, and which to use is simply a matter of personal preference. Your file structure or object names may vary from the above, though, so here's a tip: In the actions panel, there's a little icon that looks like a bullseye. It's an "insert target path" button. When you click it, you'll get a dialog box in which you can navigate your document like a tree, find the object you want to target with code, and then click either "absolute" or "relative" at the bottom, and it'll give you the proper path. Absolute means "works from anywhere" and relative means "works from here" (that is, from wherever you happen to be writing code currently). Hope all that helps.

Thanks for the reply. I was starting to wonder if anyone was out there. :)

jathomas
06-19-2006, 03:58 AM
Thanks for the reply. I was starting to wonder if anyone was out there. :)

I know what ya mean! You've saved me a good deal of trouble, at least a couple of hours, the least I can do is drop you a line and let you know it worked. I'm relatively new to AScript, so I often don't know what direction to look in when my stuff don't work!

If you want to see what I'm working on, it is at animationjason.com (http://www.animationjason.com), and should be MUCH further along soon, once I implement the thumbnail navigation you helped me with.

BluegillMedia
06-21-2006, 05:53 PM
Thanks for the help guys. As it turns out I ended up hand scripting a video interface. It allowed me to put my play buttons in the corner based on the browser size (not the flash movie size) which left the movie clean in the middle of the browser. It took a bit more time, but I think it was worth it.

I will however use the code above when I have less time (which is usually the case).

birstein
06-27-2006, 05:02 AM
Create a new flash file. Drag an instance of the FLVPlayback component onto the stage. Give it an instance name. I chose "myPlayer" for a name. Now all you have to do is create a couple of buttons, one for each video you want to load. For simplicity's sake, I'll give them instance names of video1_btn and video2_btn. You'll have to make sure there's a couple of corresponding FLV files in the same folder as your app. Make sure you save the app to that same folder, also, as it won't work if it's just "untitled1" or whatever.

Create an actions layer on the main timeline, click on frame 1, press F9, enter the following code:

video1_btn.onRelease = function() {
myPlayer.contentPath = "first_video_filename.FLV";
}
video2_btn.onRelease = function() {
myPlayer.contentPath = "second_video_filename.FLV";
}

So if you think the secret is to not use components, I beg to differ. The above is really simple, no? And it worked fine for me. Give it a try.
This does not work for me. If I click Video 1 button it will play the first video but when I click Video 2 button nothing happens. If I exit SWF and start again and click Video 2 button first, it will play just fine but when I click Video 1 button, nothing happens. Any ideas? i can't imagine what I'm doing wrong...instructions are so simple...

Mazoonist
06-27-2006, 05:27 AM
Hey birstein,
Only thing I can think of that it might be is this:

Are you using simple buttons, or are you using the component buttons? Because sometimes the component buttons goof up if you set onRelease handlers for them, because they weren't designed to work that way. Either:

1. Use simple buttons. Make a shape onstage and convert to button symbol. Your onRelease handlers stay the same. --or--

2. Go ahead and use the component buttons. But re-write the handlers like this:

video1.clickHandler = function() {
myPlayer.contentPath = "first_video_filename.flv";
}
video2.clickHandler = function() {
myPlayer.contentPath = "second_video_filename.flv";
}

birstein
06-28-2006, 02:16 AM
Dear Mazoonist:

Thanks for the suggestions but I called Flash support today and actually found out that there is a BUG(!) in the FLVPlayback where if you are using streaming server URLs in your contentPaths, the second rmtp URL you click on will NOT be sent properly to the component unless you OMIT the ".flv" in the contentPath URLS! The issue is discussed here:

Issues streaming second FLV from Flash Media Server
http://www.adobe.com/go/4882b765

Additionally, there is a bug whereby the videos are sized smaller and smaller each time you click on the buttons to change them. Weird or what??? Macromedia is going to get me back on this problem but it the meantime I'm specifically setting the width and height every time. Here's my code, which works (I used the Component buttons):

video1_btn.onRelease = function() {
myPlayer.contentPath = "rtmp://button1_url_here_withNOextension";
_root.myPlayer.height=240
_root.myPlayer.width = 320
}
video2_btn.onRelease = function() {
myPlayer.contentPath = "rtmp://button2_url_here_withNOextension";
_root.myPlayer.height=240
_root.myPlayer.width=320
}

Finally, there is an update to the FLVPlayback Component that was released 6/20/2006. You can download it here:

http://www.adobe.com/support/flash/downloads.html

here's what it does:

Flash Professional 8 FLVPlayback 1.0.1 Component Update
6/20/2006 This update provides fixes for problems related to SMIL support in the initial release of the FLVPlayback component. It also addresses some issues related to streaming from the Flash Media Server and Flash Video Streaming Service (FVSS) partners as well as some minor issues related to using custom UI controls. Anyone working with the FLVPlayback components should apply this update. Installation instructions are included with the download in the Readme file.

birstein
06-28-2006, 04:24 PM
Hi Masoonist:

Thanks for your reply. I discovered, however, that the problem I was having was because of a BUG in the FLVPlayback with streaming "rmtp://" URLS in the "contentPATH" parameter. The fix was simply to OMIT the ".flv" extensions. The problem is described here: http://www.adobe.com/go/4882b765. The following code, placed on Frame 1 of the movie, using Component buttons, after removal of the file extensions, now works.

Another BUG is that when I play the move and switch back and forth between the videos by clicking the buttons they get smaller and smaller every time! I talked to Macromedia support about this and their tech support guy was able to duplicate the problem using my rmtp URLs so they suggested I explicitly set the height and width every time until they come up with a fix, which is an adequate soluteion.

Also, there is a FLVPlayback component update (1.0.1) that was posted 6/20/2006 which can be obtained here http://www.adobe.com/support/flash/downloads.html.

Cheers!

video1_btn.onRelease = function() {
myPlayer.contentPath = "rtmp://domain/flvname";
_root.myPlayer.height=240
_root.myPlayer.width = 320
}
video2_btn.onRelease = function() {
myPlayer.contentPath = "rtmp://domain/secondflvname";
_root.myPlayer.height=240
_root.myPlayer.width=320
}

bosco123
10-12-2006, 11:59 PM
how do i make a button to hide or make flvplaback component remove from stage

distantdog
02-21-2007, 07:54 PM
Hi Masoonist:

Thanks for your reply. I discovered, however, that the problem I was having was because of a BUG in the FLVPlayback with streaming "rmtp://" URLS in the "contentPATH" parameter. The fix was simply to OMIT the ".flv" extensions. The problem is described here: http://www.adobe.com/go/4882b765. The following code, placed on Frame 1 of the movie, using Component buttons, after removal of the file extensions, now works.

Another BUG is that when I play the move and switch back and forth between the videos by clicking the buttons they get smaller and smaller every time! I talked to Macromedia support about this and their tech support guy was able to duplicate the problem using my rmtp URLs so they suggested I explicitly set the height and width every time until they come up with a fix, which is an adequate soluteion.

Also, there is a FLVPlayback component update (1.0.1) that was posted 6/20/2006 which can be obtained here http://www.adobe.com/support/flash/downloads.html.

Cheers!

video1_btn.onRelease = function() {
myPlayer.contentPath = "rtmp://domain/flvname";
_root.myPlayer.height=240
_root.myPlayer.width = 320
}
video2_btn.onRelease = function() {
myPlayer.contentPath = "rtmp://domain/secondflvname";
_root.myPlayer.height=240
_root.myPlayer.width=320
}

I just wanted to say that I have been having the same issue and these fixes DID NOT work.

What we are going to try doing as a result of this entirely STUPID problem that ADOBE/Macromedia overlooked is creating and deleting the FLV component for each movie we want to play... we think this will work. But nevertheless we are sstillllll annnnooooyyeedddd. :mad:

flashneofite33
05-24-2007, 08:05 PM
All you have to do is drag an instance of the FLVplayback component on the stage name it videoPlayer. Then make several buttons that change the content path.

Example:

vid1_btn.onRelease = function(){
videoPlayer.contentPath = "video1.flv";
}
vid2_btn.onRelease = function(){
videoPlayer.contentPath = "video2.flv";
}
vid3_btn.onRelease = function(){
videoPlayer.contentPath = "video3.flv";
}

BluegillMedia
05-24-2007, 08:17 PM
The lesson i learned doing these such things is to avoid the component and do it by hand with a player.