我试图在我的应用中将视频设置为背景,但是遇到了问题 - 我的活动中仍然在行mp.setDataSource(视频)中获取null。我试图找到解决方案,但没有发现任何相似之处。我有什么建议我做错了吗?
我把我的视频文件放在res / raw文件夹中。 `
CREATE DEFINER=`Library`@`localhost` PROCEDURE `download`(
IN p_assignmentId INT(11),
IN p_userId INT(11)
)
BEGIN
DECLARE p_credit INT unsigned DEFAULT 1;
DECLARE p_downloads INT unsigned DEFAULT 1;
SELECT credit
INTO p_credit
FROM Users
WHERE userId = p_userId;
SELECT downloads
INTO p_downloads
FROM Assignments
WHERE assignmentId = p_assignmentId;
UPDATE Users
SET credit = p_credit - 1
WHERE userId = p_userId;
UPDATE Assignments
SET downloads = p_downloads +1
WHERE assignmentId = p_assignmentId;
END
答案 0 :(得分:0)
我认为这不会产生正确的URI:
Uri video = Uri.parse("android.resource://" + getPackageName() + "/"
+ R.raw.video)
您可以为给定的原始资源创建一个MediaPlayer,如下所示:
mp = MediaPlayer.create(this, R.raw.video);