multithreading - j2me Threading with video component -
I have tried to implement a Java application, which has the following structure.
My problems are
-
When I say the quote thread video from the video player thread still plays at the top of the quote form.
When I change the video URL with the action event, then it only adds an existing one to the player with the former. Video 2 is currently attached to Video 1 when I press Video 2 button
.
Class VideoPlayer Playable, Action Listener {Private Video App Middlelet; VideoComponent vc; Button video, quote, video 1, video 2, video 3; Form video player; Thread thread; Public Videoplayer (Video App Midlet Midlet) {this.Midlet = MIDlet; } Public run zero () {try {videoplayer = new form ()} video 1 = new button ("Video 1"); ....... vc = VideoComponent.createVideoPeer ("http: //localhost/video1.mpg"); Vc.start (); Quotes Addition Listener ((Actualist) This); ........ videoplayer.addComponent (vc); ........ videoplayer.show (); } Hold (exception error) {System.err.println (error.toString ()); }} Public Zero Start () {thread = new thread (this); {Thread Start ();} Catch (Exception Error) {}} Public Zero Function (Action AE) {if ((ae.getSource () == quotation marks) {Quotes tp = new Quotes (this.MIDlet); tp.start ( );} If (ae.getSource () == video1) {try {vc = VideoComponent.createVideoPeer ("http: //localhost/video1.mpg"); vc.start ();} hold (IOException pre) { Ex.printStackTrace ();}} ....}} Class quotes runnabal, exemplarist {private videoapp midlet; button video, quotation; form quote; thread thread; public quote (videoapp midlet midlet) {this.MIDlet = MIDlet;} Public run to zero () {Try {quote = new form (}} video = new button ("video"); ....... quote.addComponent (video); ........ video.eduction listener (this) ; ........ quote.show ();} hold (exception error) {System.err.println (error.toString ());}} Public Zero Start () {thread = new thread (this) ; Thread; start ();} hold (exception error) {}} public zero verb executed (action ae) {if (ae.getSource () == video) {videoplayer VP = new video player (this.MIDlet); Vp.start (); }}} Public class videoapp midlet mitlate and action listener (button play, quote; form home; public zero startApp () {Display.init (this); home = new form; play.addActionListener (this); quote.addActionListener (This); home.show ();} Public Zero Improvisual (Action AE) {if (AE.GetSource () == Play} {VIDEOPlayer VP = New Videoplayer (vi); vp.start ();} If (AE .getSource () == Excerpt) {quotation TP = new quote (this); tp.start (); Usually Java in Java Java does not guarantee that layer LWUIT tries to stop the video player for things like Dialogues at the top of the UI.
The LWU thread is not secure as a side note and access to the UI Different threads should not be used because it will break on different platforms.
Comments
Post a Comment