Draw primitives and Video

All your problems with Audio, Video and Images.

Draw primitives and Video

Postby chabfive » Tue Dec 09, 2008 10:04 am

Hi everyone,

I have some problems to draw primitives on a SurfaceView's canvas and to display a video on another SurfaceView in the same time.

When I start the video, this one works but primitives which are previously displayed are no more displayed. Because SurfaceHolder.lockCanvas() return null.

I used a RelativeLayout and two SurfaceViews.

Somebody have any idea?

Thanks.
chabfive
Freshman
Freshman
 
Posts: 8
Joined: Tue Dec 09, 2008 9:53 am

Top

Postby chabfive » Wed Dec 10, 2008 9:49 am

When I speak about primitives, I want to say shapes, line, text on a canvas.

I begin to think that anybody have created a video player without the android UI.

Perhaps it is not possible. Anybody have done a video overlay?

Thanks for your help.
chabfive
Freshman
Freshman
 
Posts: 8
Joined: Tue Dec 09, 2008 9:53 am

Postby chabfive » Tue Dec 16, 2008 5:14 pm

Hi, again

Anybody have drawn a video over a canvas.

I retrieved the canvas from a SurfaceView and I used a VideoView to display my video.
I create the VideoView only when I launch the video.

My issue is that the video stay under the SurfaceView.
If I shift the SurfaceView with margin, I can see a part of my video.
If I set a background to my VideoView, I can see the VideoView over the SurfaceView (without the video, only the color of the background).
The sound of the video is always audible.

Anybody have an idea.

Thanks.
chabfive
Freshman
Freshman
 
Posts: 8
Joined: Tue Dec 09, 2008 9:53 am

Postby hebbalhrk » Mon Dec 22, 2008 10:57 am

Try out this..

xml:
<SurfaceView android:id="@+id/surface"
android:layout_width="fill_parent"
android:layout_height="250px"
android:layout_gravity="center">
</SurfaceView>

java:

public class VideoActivity extends Activity implements SurfaceHolder.Callback {

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
...
...
getWindow().setFormat(PixelFormat.TRANSPARENT);
SurfaceView videoView = (SurfaceView) findViewById(R.id.surface);
SurfaceHolder videoHolder = videoView.getHolder();
videoHolder.addCallback(this);
videoHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
videoHolder.setFixedSize(display.getWidth(), 300);

playmedia("The media path");

}

private void playmedia(String songpath) {
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(2);
mediaPlayer.setDataSource(songpath);
mediaPlayer.setDisplay(videoHolder);

mediaPlayer.prepare();
mediaPlayer.start();
}

}
hebbalhrk
Developer
Developer
 
Posts: 37
Joined: Wed Jun 18, 2008 10:35 am

Postby chabfive » Thu Feb 19, 2009 3:56 pm

I apologise for my late response.

But thanks hebbalhrk, that's work.

Now, I have an other problem.

I initialize the videoView visibility to "invisible":

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <VideoView android:id="@+id/videoView"
  2.                   android:layout_width="176px"
  3.                   android:layout_height="144px"
  4.                   android:visibility="invisible">
  5. </VideoView>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Next, when I call prepareAsync(), my application crash and I have the debug log below:



I/DEBUG ( 2072): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 2072): Build fingerprint: 'generic/generic/generic/:1.0/110632/110632:sdk/test-keys'
I/DEBUG ( 2072): pid: 2239, tid: 2254 >>> com.streamezzo.browser.android <<<
I/DEBUG ( 2072): signal 11 (SIGSEGV), fault addr 0000001c
I/DEBUG ( 2072): r0 453dad80 r1 ffffe518 r2 ffffe7ac r3 00000000
I/DEBUG ( 2072): r4 ab3061a0 r5 001b8ee0 r6 453dad80 r7 434239d8
I/DEBUG ( 2072): r8 453dada0 r9 41040f68 10 41040f54 fp 00000001
I/DEBUG ( 2072): ip ad07ee38 sp 453dad78 lr ad03e3a9 pc ab302dc4 cpsr 00000030
I/DEBUG ( 2072): #00 pc ab302dc4 /system/lib/libmedia_jni.so
I/DEBUG ( 2072): #01 pc ad00d9f4 /system/lib/libdvm.so
I/DEBUG ( 2072): #02 pc ad04120e /system/lib/libdvm.so
I/DEBUG ( 2072): #03 pc ad012748 /system/lib/libdvm.so
I/DEBUG ( 2072): #04 pc ad02a92c /system/lib/libdvm.so
I/DEBUG ( 2072): #05 pc ad0169d0 /system/lib/libdvm.so
I/DEBUG ( 2072): #06 pc ad051f10 /system/lib/libdvm.so
I/DEBUG ( 2072): #07 pc ad051f30 /system/lib/libdvm.so
I/DEBUG ( 2072): #08 pc ad047638 /system/lib/libdvm.so
I/DEBUG ( 2072): #09 pc afe0ed08 /system/lib/libc.so
I/DEBUG ( 2072): #10 pc afe0e87c /system/lib/libc.so
I/DEBUG ( 2072): stack:
I/DEBUG ( 2072): 453dad38 434239d8
I/DEBUG ( 2072): 453dad3c ad03f10b /system/lib/libdvm.so
I/DEBUG ( 2072): 453dad40 ad07e5a8
I/DEBUG ( 2072): 453dad44 4108e1e8
I/DEBUG ( 2072): 453dad48 001b8ee0 [heap]
I/DEBUG ( 2072): 453dad4c ab306568
I/DEBUG ( 2072): 453dad50 ad07d888
I/DEBUG ( 2072): 453dad54 433f02f0
I/DEBUG ( 2072): 453dad58 453dad80
I/DEBUG ( 2072): 453dad5c ab302991 /system/lib/libmedia_jni.so
I/DEBUG ( 2072): 453dad60 43423f70
I/DEBUG ( 2072): 453dad64 ab3061a0
I/DEBUG ( 2072): 453dad68 001b8ee0 [heap]
I/DEBUG ( 2072): 453dad6c 453dad80
I/DEBUG ( 2072): 453dad70 df002777
I/DEBUG ( 2072): 453dad74 e3a070ad
I/DEBUG ( 2072): #00 453dad78 00000004
I/DEBUG ( 2072): 453dad7c 001c3208 [heap]
I/DEBUG ( 2072): 453dad80 00000000
I/DEBUG ( 2072): 453dad84 001c5b48 [heap]
I/DEBUG ( 2072): 453dad88 00000004
I/DEBUG ( 2072): 453dad8c 453dadc0
I/DEBUG ( 2072): 453dad90 00000000
I/DEBUG ( 2072): 453dad94 ab302d71 /system/lib/libmedia_jni.so
I/DEBUG ( 2072): 453dad98 41040f70
I/DEBUG ( 2072): 453dad9c ad00d9f8 /system/lib/libdvm.so
I/DEBUG ( 2072): #01 453dada0 410f7160
I/DEBUG ( 2072): 453dada4 001ba330 [heap]
I/DEBUG ( 2072): 453dada8 ab302d71 /system/lib/libmedia_jni.so
I/DEBUG ( 2072): 453dadac 00000000
I/DEBUG ( 2072): 453dadb0 000010f8
I/DEBUG ( 2072): 453dadb4 001ba330 [heap]
I/DEBUG ( 2072): 453dadb8 453dadc0
I/DEBUG ( 2072): 453dadbc ad041211 /system/lib/libdvm.so
I/DEBUG ( 2072): debuggerd committing suicide to free the zombie!
I/ActivityManager( 48 ): Process com.streamezzo.browser.android (pid 2239) has died.
D/Zygote ( 23): Process 2239 terminated by signal (11)
I/DEBUG ( 2256): debuggerd: Sep 22 2008 13:36:12
I/WindowManager( 48 ): WIN DEATH: Window{4344b790 SurfaceView}
I/WindowManager( 48 ): WIN DEATH: Window{4341bd20 com.streamezzo.browser.android/com.streamezzo.browser.android.RichMedia}


Any idea.

Thanks
chabfive
Freshman
Freshman
 
Posts: 8
Joined: Tue Dec 09, 2008 9:53 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 21 guests