Live Video Streaming

i have a problem, when i live stream my video ,it will record but when i make it stop . it will make all my program hang and then i need to reset . can anyone of you let me know how i can overcome with this issue and it will not disturbed my other code and work perfectly

void keyPressed() {

if (keyCode == 32) {

try {

  enc.finish();
} 
catch (IOException e) {

  e.printStackTrace();
}

}

}

Tagged:

Answers

  • Answer ✓

    Format your code. Edit your post, select code and hit ctrl+o.

    Kf

  • Answer ✓

    I guess you make it stop when you press ENTER or are you referring to when you make a click? When you press ENTER (I believe that is what 32 is referring to) you are calling enc.finish() but your draw method is still accessing your encoder. I would suggest removing your mouse action and make sure recording is set to false before you call end.finish().

    I can't test your code but try:

    void keyPressed() {
    
      if (key == ENTER) {
        recording=false;   //  **  CHANGE: ADDED
        try {
          enc.finish();
        } 
        catch (IOException e) {
          e.printStackTrace();
        }
      }
    
    }
    

    Kf

  • Thank You Kfrajer . The way you suggest me with that my problem solved now .

  • may i know one more thing. if i want to make something like " look at " (trekking object ,locking it and then make my camera follow that object automatically ). can you guide me on that ?

  • @James_Anderson -- please format your code. Edit your post (gear icon on upper right), highlight code and hit ctrl+o, save.

  • Answer ✓

    @James_Anderson

    trekking object ,locking it and then make my camera follow that object automatically

    Create a new post with your question. You might get hints, maybe code. Also, it is important to format your code.

    Kf

  • @jeremydouglass : thanks and i format my code now . and thanks Kfrajer for your suggestion . will make new post on that. thank you both

Sign In or Register to comment.