Hi,
I need help for the following. I am trying to stream a video (webcam)
from my PC to my android phone (HTC Magic/Vodaphone, Android 1.6) by
using multicast UDP. I have a second notebook in the network to check
the network is OK.
The following configs works:
- Webcam ->quicktime broadcaster (encoder) -> quicktimestreaming
server -> upd unicast ->router (wlan) > android phone
- Webcam ->quicktime broadcaster (encoder) -> quicktimestreaming
server -> upd unicast ->router (wlan) > notebook w/ quicktimeplayer
- Webcam ->quicktime broadcaster (encoder) -> quicktimestreaming
server -> upd multicast ->router (wlan) > notebook w/quicktimeplayer
And the wanted config doens't work:
- Webcam ->quictime broadcaster (encoder) -> quicktimestreaming server
-> upd multicast ->router (wlan) > android phone
Did anyone try this before and can confirm it is working? Does
Android, and especially 1.6 on HTC magic support mulitcasting? If
yes, some example code would be very useful.
The code I am using:
public class Streaming extends Activity implements
MediaPlayer.OnPreparedListener,
MediaPlayer.OnErrorListener,
MediaPlayer.OnCompletionListener {
/**
* TODO: Set the path variable to a streaming video URL or a local
media
* file path.
*/;
private String pathStr3 = "rtsp://<ip-address>/rtplive2.sdp";
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
WifiManager wm = (WifiManager)getSystemService
(getApplicationContext().WIFI_SERVICE);
MulticastLock wmmc = wm.createMulticastLock("mylock");
wmmc.acquire();
Toast.makeText(this,"Multicast (after) = "+wmmc.isHeld
(),Toast.LENGTH_LONG).show();
mVideoView = (VideoView) findViewById(R.id.mfsView_vv);
if (pathStr3 == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(
Streaming.this,
"Please edit VideoViewDemo Activity, and set path"
+ " variable to your media file URL/path",
Toast.LENGTH_LONG).show();
} else {
/*
* Alternatively,for streaming media you can use
* mVideoView.setVideoURI(Uri.parse(URLstring));
*/
Toast.makeText(this,"Path =
"+pathStr3,Toast.LENGTH_LONG).show();
mVideoView.setVideoURI(Uri.parse(pathStr3));
mVideoView.setOnPreparedListener(this);
mVideoView.setOnErrorListener(this);
mVideoView.setOnCompletionListener(this);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
}
}
public void onPrepared(MediaPlayer mp) {
Toast.makeText(this, "MediaPlayer Started",Toast.LENGTH_LONG).show
();
mp.start();
}
public boolean onError(MediaPlayer mp, int what, int extra) {
Toast.makeText(this, "Sorry, can't play video. Error ="+
what,Toast.LENGTH_LONG).show();
return false;
}
public void onCompletion(MediaPlayer mp) {
Toast.makeText(this, "Done. Completed.
Finito!",Toast.LENGTH_LONG).show();
}
}
The rtplive.sdp file (available on a server):
v=0
o=- 51 3553371012 IN IP4 127.0.0.0
s=QuickTime
t=0 0
a=range:npt=now-
a=isma-compliance:2,2.0,2
m=audio 10000 RTP/AVP 96
c=IN IP4 238.210.243.42/15
b=AS:8
a=rtpmap:96 mpeg4-generic/8000/1
a=fmtp:96 profile-level-id=15;mode=AAC-
hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1588
a=mpeg4-esid:101
m=video 10002 RTP/AVP 97
c=IN IP4 238.210.243.42/15
b=AS:220
a=rtpmap:97 H264/90000
a=fmtp:97 packetization-mode=1;profile-level-id=4D400C;sprop-parameter-
sets=J01ADKkYKD9gDUGAQa2wrXvfAQ==,KN4JF6A=
a=mpeg4-esid:201
a=cliprect:0,0,240,320
a=framesize:97 320-240
Using the same audio/video codec in unicast session is working. So it
looks like if multicasting seems to be the blocking factor.
The corresponding logs:
01-28 18:24:40.363: VERBOSE/VideoView(14988): reset duration to -1 in
openVideo
01-28 18:24:40.363: DEBUG/MediaPlayer(14988): Couldn't open file on
client side, trying server side
01-28 18:24:40.932: INFO/ActivityManager(74): Displayed activity
de.pureP.myFirstStreaming/.Streaming: 1202 ms (total 1202 ms)
01-28 18:24:41.152: ERROR/PlayerDriver(51): Command PLAYER_INIT
completed with an error or info PVMFFailure
01-28 18:24:41.162: ERROR/MediaPlayer(14988): error (1, -1)
01-28 18:24:41.162: ERROR/MediaPlayer(14988): Error (1,-1)
01-28 18:24:41.162: DEBUG/VideoView(14988): Error: 1,-1
01-28 18:24:41.192: WARN/PlayerDriver(51):
PVMFInfoErrorHandlingComplete
If anyone could give me hint that would be really great.
Thx in advance.
eh
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en