android - error (1, -2147483648) Cannot Play this Video -
i trying play .mp4 video file, have added in raw
folder. result error (1, -2147483648)
in logcat.
after research notice caused unsupported codec/format. last 2 days rendered video in adobe premiere according http://developer.android.com/guide/appendix/media-formats.html? in supportd formats , many more.the result same: error , "can't play video." when app launches.
my java code this:
public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); videoview vv = (videoview) findviewbyid(r.id.videoview); string filename = "//biolab/res/raw/sequence"; vv.setvideouri(uri.parse(filename)); vv.start(); } }
and main activity this:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <videoview android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/videoview"/> </relativelayout>
i have seen games play fullscreen videos, company logo video. how it? there must universal way.
note: use in java code path "//biolab/res/raw/sequence"
because if use "/biolab/res/raw/sequence.mp4"
or “android.resource://” + getpackagename() +”/”+r.raw.video
error in
logcat: error opening trace file: no such file or directory (2)
error (1, -2147483648)
means link feed mediaplayer( videoview in case) invalid or file corrupted.
way trying file raw folder fishy.
trying following.
assuming name of file trying play sequence.**
public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); setcontentview(r.layout.activity_main); videoview vv = (videoview) findviewbyid(r.id.videoview); string path = "android.resource://" + getpackagename() +"/"+ r.raw.sequence; log.d("tag", path); uri url=uri.parse(path); vv.setvideouri(url); vv.start(); vv.requestfocus(); } }
Comments
Post a Comment