5

I want to play video in listview from online server as like VINE app. And plays only one video at a time.But videoview cann't show in listview. I can view all others like text, links. But VideoView cann't show in listview row. show all without videoview. when try without listview it works fine and play video from online my listview adapter code snippet like this:

mViewHolder.mVideoView.setVisibility(View.VISIBLE);
MediaController mComtroller = new MediaController(mContext);
mViewHolder.mVideoView.setMediaController(mComtroller);
mViewHolder.mVideoView.setVideoURI(Uri.parse("myLink"));
mViewHolder.mVideoView.start();
mViewHolder.mVideoView.requestFocus();

layout row of listview:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:weightSum="100" >
        <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_margin="5dp"
        android:layout_weight="80"
        android:weightSum="10"
        android:orientation="horizontal"
        android:background="@drawable/background" >
            <VideoView
            android:id="@+id/vv_surface_view"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:visibility="visible"
            android:layout_weight="5" />
        <ImageView
            android:id="@+id/iv_videoThumbnail"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:background="@drawable/background" />
    </LinearLayout>

    <TextView
        android:id="@+id/tv_VideoName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="10"
        android:text="TextView" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text=""
        android:layout_weight="10" />

</LinearLayout>
Newton
  • 163
  • 1
  • 13
  • If any other way without listview please suggest me, I want to show video like VINE app... – Newton Jun 10 '14 at 11:26
  • Been struggling with this issue for a while. Dont use VideoView because it does not support scrolling.TextureView is the way to go but it's not an easy implementation. Good luck!! – MoMo Nov 13 '14 at 05:38
  • @Newton did you get any solution? – Bhoomika Brahmbhatt Jun 19 '15 at 11:47
  • no i do not get any solution @geet. How to get maximum visible row of a listview if visible number of row is 3. – Newton Jun 29 '15 at 09:09
  • @Newton do you get this solution for listview ? I am in similar problem and even could not able to fixed it using scrollview. can you help me in this ? – LuminiousAndroid Nov 24 '15 at 09:55

0 Answers0