我正在尝试播放实时RTSP视频(来自rtsp://media2.tripsmarter.com/LiveTV/BTV/)VideoView,这是我的代码:
public class ViewTheVideo extends Activity {
VideoView vv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vv = (VideoView) this.findViewById(R.id.VideoView);
Uri videoUri = Uri.parse("rtsp://media2.tripsmarter.com/LiveTV/BTV/");
vv.setMediaController(new MediaController(this));
vv.setVideoURI(videoUri);
vv.requestFocus();
vv.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
vv.start();
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
这个代码在三星Galaxy Y上工作正常,甚至在模拟器上也可以,但它不能在三星Galaxy S2上运行(对不起,这个视频无法播放)!设备和模拟器都运行Gingerbread.
这是LogCat消息:
07-30 10:48:28.310: I/MediaPlayer(24573): uri is:rtsp://media2.tripsmarter.com/LiveTV/BTV/
07-30 10:48:28.310: I/MediaPlayer(24573): path is null
07-30 10:48:28.310: D/MediaPlayer(24573): Couldn't open file on client side, trying server side
07-30 10:49:13.025: W/MediaPlayer(24573): info/warning (1, 26) …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的Android手机中的实时视频流式传输到我的PC上的桌面RTSP服务器.流式视频可以在其他设备上播放.我正在使用H.264视频编码器,因此服务器返回的SDP(作为DESCRIBE请求的回复)应该包含profile-level-id和sprop-parameter-sets字段.
该Spydroid项目展示了如何提取从解析它(从记录到SD卡中的虚拟文件,这些信息avcC块).但我不能那样做.在Spydroid中,媒体记录器和RTSP服务器位于同一设备上,因此服务器始终可以在流式传输之前记录与记录器具有相同配置的测试文件.但我正在将视频直接从手机传输到远程服务器作为RTP流.
所以我的问题是:
编辑:
我正在使用Android手机生成流,但服务器可以从任何来源接收RTP流.那么,有没有通用的方法来获得这些值?
我正在使用Python中的BeautifulSoup来抓取网页.问题中的html如下所示:
<td><a href="blah.html>blahblah</a></td>
<td>line2</td>
<td></td>
Run Code Online (Sandbox Code Playgroud)
我想采取td标签的内容.所以对于第一个td,我需要"blahblah"文本,对于下一个td,我想写"line2",而对于最后一个td,"空白",因为没有内容.
我的代码片段看起来像这样 -
row = []
for each_td in td:
link = each_td.find_all('a')
if link:
row.append(link[0].contents[0])
row.append(link[0]['href'])
elif each_td.contents[0] is None:
row.append('blank')
else:
row.append(each_td.contents[0])
print row
Run Code Online (Sandbox Code Playgroud)
但是在运行时,我得到错误 -
elif each_td.contents[0] is None:
IndexError: list index out of range
Run Code Online (Sandbox Code Playgroud)
请注意 - 我正在使用beautifulsoup.
如何测试"no-content-td"和weite?为什么"......是无"不起作用?
我读了Hello Android书,我不明白这段功能的代码.
为什么我们在charAt(i)旁边使用-'0?
static protected int[] fromPuzzleString(String string) {
int[] puz = new int[string.length()];
for (int i = 0; i < puz.length; i++) {
puz[i] = string.charAt(i) - '0' ;
}
return puz;
}
Run Code Online (Sandbox Code Playgroud)
谢谢.干杯.
是否有一个c ++结构或模板(在任何库中)允许我在十进制和任何其他基础之间进行转换(很像bitset可以做什么)?
我正在使用java作为我的程序
假设我有一个像这样的字符串
xx(yyzz(iijj))qq((kkll)(gghh))
Run Code Online (Sandbox Code Playgroud)
有没有什么方法可以匹配xx(yyzz(iijj))和qq((kkll)(gghh))单独使用正则表达式?
我正在尝试使用glTexImage2D显示图像,我使用MFC,Visual C 6.0.
这里的代码:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
/* enable 2D texture mapping */
glEnable( GL_TEXTURE_2D );
glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGB,
800, 600,
0, GL_RGB, GL_UNSIGNED_BYTE, BitmapBits);
static float v0[3] = { 0.0, 0.0, 0.0 };
static float v1[3] = { 0.0, 1.0, 0.0 };
static float v2[3] = { 1.0, 1.0, 0.0 };
static float v3[3] = { 1.0, 0.0, 0.0 };
static float t0[2] = { 0.0, 0.0 };
static …Run Code Online (Sandbox Code Playgroud) 如何匹配从1开始的四位数字,并且不包含我尝试过的数字1612
1[0-9]^6[0-9]^1[0-9]^2
Run Code Online (Sandbox Code Playgroud)
但它不起作用
我需要这样的清单:
[(16,2), (14,3), (15,3), (16,3), (18,3), (19,3), (12,4), (13,4), (14,4)]
Run Code Online (Sandbox Code Playgroud)
但是,要长得多。此列表中确实有一些非常大的范围模式,但也有不规则之处。因此,写下所有元组是不可行的,但是我也无法创建简单的listcomp。
我想使用:
[(16,2), (x,3) for x in range(14,19), (x,4) for x in range(12,14)]
Run Code Online (Sandbox Code Playgroud)
但是根据文档,这[x, y for ...]是不允许的,并且我的示例被解释为由2个带括号的元组组成的无括号元组,而不是后跟列表理解的元组。
有什么办法吗?
我们假设,
g = ['1', '', '2', '', '3', '', '4', '']
Run Code Online (Sandbox Code Playgroud)
我想''从g中删除所有,我必须得到
g = ['1', '2', '3', '4']
Run Code Online (Sandbox Code Playgroud)