Flash Video Player Issue

This is a discussion on "Flash Video Player Issue" within the Flash & Multimedia Forum section. This forum, and the thread "Flash Video Player Issue are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 20th, 2007, 22:08
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sgaspar11
Flash Video Player Issue

Hello everyone,

I'll do my best to explain this, unfortunately I cannot give you the source files because they are proprietary information but I can share some of the code.

So Situation: I've built a flash video player that streams from our flash communication server. (no big deal) I've built in a bandwidth detection function that will determine the bandwidth of the user and play the appropriate sized video from our streaming server in the flash video player, (aka: _56k, _256k, _512k and so on) all of this works fine.

Next: I've also built into the code two error messages:
1. If the video stream is missing for some reason it goes to and stops at frame 3 to display a message stating the video is missing.
2. If the user is have internet connectivity issues (say port 1935(flash streaming server port) is blocked by their admin it goto and stops at frame 4, which says to contact their IT department and unblock 1935.

The issue I am having is with #1 - when I purposley cause the video to not be found it goes to the right frame(3) but then it jumps into the action script once again and starts the whole process over(of detecting bandwidth, finding and compiling the steamname, etc) and ofcourse still goes to frame(3) to display the "video not found message"

I can't seem to figure out where in my code it is causing it to take a second pass through the dectection process. Maybe someone here can help, here is the code that is causing the problem....the entire thing is 600-ish lines so I don't want to include it all)

Edit: The code you don't see is basically the bandwidth detection, stream name compiler and the movie controls. The code below connects to the streaming service(vitalstream is our back up server) and looks for the file. If it cannot be found then gotoandstop(3), or if the connection times out gotoandstop(4);


Code: Select all
 
function startStream(p_nc, p_bw) {
 ns = new NetStream(p_nc);
 //this will attacth the video to the video object.
 // in this instance the video object is named player, change
 // this to match whatever you are using.  The Video Object is
 // inserted into the frame from the library.
 v1.my_video.attachVideo(ns);
 ns.setBufferTime(buffertime);
 ns.play(m_streamName, frame, 0); // 0
    // my_inter = setInterval(newFrame, 6000);
 //  this will print all netstream status information that the player recieves
 my_mc._alpha = 0;
 ns.onStatus = function(info) {
  trace(info.code + " : " + info.description);
  if (info.code == "NetStream.Play.StreamNotFound") {
   trace(m_streamName + " not found");
      if (!tryingVitalStream) { 
            trace("--- Falling back to VitalStream ---");
            VitalStream(); 
      newFrame();
         } else 
     {
    if (VitalStreamConnected) { 
     gotoAndStop(3); 
    }
     }
    };
  if(info.code == "NetStream.Play.Stop") {
   if(!stills) {
    my_c.playButton._visible = true;
    my_c.pauseButton._visible = false;
    box._visible = true;
    clearInterval(time_interval);
    stills = true;
    mOver();
    frame = 2;
    ns.play(m_streamName, frame, 0); // 0
    my_inter = setInterval(newFrame, 6000);
    my_c.bar.onEnterFrame = function() {
     if(this._alpha > 0) {
      this._alpha -= 10;
     } else {
      this.onEnterFrame = null;
     }
    }
   }
  } else if(info.code == "NetStream.Play.Start") {
   if(loading._visible == true) {
    loading.onEnterFrame = function() {
     if(this._alpha > 0) {
      this._alpha -= 10;
     } else {
      this.onEnterFrame = null;
      this._visible = false;
     }
    }
   }
  }
 }
}
//  this will kill all pending netConnections in the event that none succeed
//  by the end of the time interval and fall back to VitalStream
function onFlashComConnectTimeOut() {
 trace("onFlashComConnectTimeOut Called: All connections failed");
 clearInterval(m_flashComConnectTimeOut);
 for (var i = 0; i < m_connList.length; i++) {
  if (this.mc["nc" + i].pending) {
   clearInterval(this.mc["ncInt" + i]);
   this.mc["nc" + i].onStatus = null;
   this.mc["nc" + i].close();
   this.mc["nc" + i] = null;
   delete this.mc["nc" + i];
  }
 }
 if (!tryingVitalStream) { 
    trace("Falling back to VitalStream");
    VitalStream();
    newFrame();
 } else {
  gotoAndStop(4);
   }
}

Thanks in advance! (I hope this makes sense)

Scott
Last Blog Entry: Yay!? (Oct 8th, 2007)

Last edited by Sgaspar11; Apr 20th, 2007 at 22:54.
Reply With Quote

  #2 (permalink)  
Old Apr 23rd, 2007, 14:03
Reputable Member
Join Date: May 2006
Location: NC, USA
Age: 16
Posts: 355
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to MrMadison Send a message via MSN to MrMadison Send a message via Skype™ to MrMadison
Re: Flash Video Player Issue

Well, This might be the problem.
You said that if the video is not found it will take the user to Frame three...
You said
Code: Select all
{
               if (VitalStreamConnected) {
                gotoAndStop (3);
}
Check that out and see if that helps at all.
Reply With Quote
  #3 (permalink)  
Old Apr 24th, 2007, 18:14
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sgaspar11
Re: Flash Video Player Issue

Hey I did some more goofing with it and I still running into the same issue. It is only happening when I hit a good connection speed. When I get 56k, 112k it works right everytime, and even with 256k and 512k it only blinks...sometimes...

As for the code above, it is checking to see if VitalStream connects, if it does(but doesn't find the movie still) goto(3). "cannot find movie"

Otherwise it displays the other message(4) "your connection isn't working, port blocked" as an example.
Last Blog Entry: Yay!? (Oct 8th, 2007)
Reply With Quote
  #4 (permalink)  
Old Apr 28th, 2007, 06:26
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: Flash Video Player Issue

hmmm, I hate to say it I can't see anything wrong off hand. But I will pass it on to Justin (Flash Specialist I know), maybe he can take a peek.
Reply With Quote
  #5 (permalink)  
Old May 3rd, 2007, 15:53
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sgaspar11
Re: Flash Video Player Issue

Alright so, fixed it.

Code: Select all
 
function onConnectTimeOut() {
 trace("onConnectTimeOut Called: All connections failed");
 clearInterval(j_flashComConnectTimeOut);
 clearInterval(this);
 this.onStatus = null;
 this.close();
 this = null;
 delete this;
 gotoAndStop(2);
}
I had this code on the first frame when it was doing the BW detection. I had a function that was supposed to wipe the onConnectTimeOut() that wasn't working. I just removed this function(since it tests for timeout on frame(2) and it works great now.

Phew, talk about a pain in the you know what...
Last Blog Entry: Yay!? (Oct 8th, 2007)
Reply With Quote
Reply

Tags
video, flash communication server, flash

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Centering a video player. aaronh Starting Out 1 Sep 21st, 2007 04:23
Video player preview Image fade to video Lchad Flash & Multimedia Forum 10 Sep 4th, 2007 15:37
Live Streaming Video Feeds with Flash Player? kinkarso Flash & Multimedia Forum 1 Aug 5th, 2007 23:35
I really need help badly with my custom video player...! jaythan Flash & Multimedia Forum 1 Feb 14th, 2007 17:43
Inserting a Flash video player into xhtml Powderhound Flash & Multimedia Forum 6 Nov 20th, 2006 13:33


All times are GMT. The time now is 19:58.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43