视频画中画学习

最近在研究做视频画中画

1,用Android原生的视频播放器两个videoview叠加,是可以实现视频画中画的

但是用UPlayer和VideoView相互叠加。。就实现不了这个功能。

最后在布局文件上找到了临时的解决办法。。只是为了快速开发一个创业项目的app(好笑头条君)

代码如下:

xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <FrameLayout
        android:id="@+id/detail_activity_framelayout"
        android:layout_alignParentTop="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <RelativeLayout
            android:visibility="visible"
            android:id="@+id/detail_activity_danmu_video_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|right"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="@dimen/detail_activity_danmu_video_layout_marginbottom"
            android:layout_marginRight="@dimen/detail_activity_danmu_video_layout_marginright">
	    
            <VideoView
                android:visibility="visible"
                android:layout_width="@dimen/detail_activity_danmu_videoview_width"
                android:layout_height="@dimen/detail_activity_danmu_videoview_height"
                android:id="@+id/detail_activity_danmu_videoview"/>
        RelativeLayout>
           
        <com.youku.player.base.YoukuPlayerView
            android:layout_alignParentTop="true"
            android:id="@+id/detail_activity_youkuplayview"
            android:visibility="visible"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
        com.youku.player.base.YoukuPlayerView>
        <ImageView
            android:visibility="invisible"
            android:layout_gravity="bottom|right"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:id="@+id/detail_danmu_video_background"
            android:layout_marginBottom="@dimen/detail_danmu_video_background_marginbottom"
            android:layout_marginRight="@dimen/detail_danmu_video_background_marginright"
            android:background="@drawable/detail_danmushipin"
            android:layout_width="@dimen/detail_danmu_video_background_width"
            android:layout_height="@dimen/detail_danmu_video_background_height" />

        <RelativeLayout
            android:visibility="visible"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|right"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="@dimen/detail_activity_danmu_headicon_layout_marginbottom"
            android:layout_marginRight="@dimen/detail_activity_danmu_headicon_layout_marginright">
            <com.youku.widget.CircleImageView
                app:civ_border_width="2dp"
                app:civ_border_color="@color/transparent_gray"
                android:visibility="invisible"
                android:layout_marginLeft="10dp"
                android:id="@+id/detail_activity_danmu_headicon"
                android:layout_width="@dimen/detail_activity_danmu_headicon_width"
                android:layout_height="@dimen/detail_activity_danmu_headicon_height"
                android:src="@drawable/detail_head_def"/>
        RelativeLayout>

    FrameLayout>
    

    <include
        android:id="@+id/detail_player_footer"
        layout="@layout/detail_player_footer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/detail_player_footer_margin"
        android:layout_below="@id/detail_activity_framelayout" />
    <include
        android:id="@+id/detail_footer_tab"
        layout="@layout/detail_footer_tab"
        android:layout_width="match_parent"
        android:layout_height="@dimen/detail_activity_detail_footer_tab"
        android:layout_alignParentBottom="true" />
    <ListView
        android:id="@+id/detail_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/detail_player_footer"
        android:layout_above="@id/detail_footer_tab"
        android:paddingTop="@dimen/detail_danmu_item_margin"
        android:paddingBottom="@dimen/detail_list_paddingbottom"
        android:background="#fefefe"
        android:divider="@null"
        android:cacheColorHint="@null"
        android:scrollbars="none"
        android:dividerHeight="@dimen/detail_list_dividerheight">
    ListView>
RelativeLayout>
 
  
2,整个播放器就是一个UPlayer+VideoView来实现画中画效果,另一个名称叫视频弹幕
 
  
效果图如下:
 
  
其中小窗口的背景用的是掏空的一个黑色背景框。。。
 
  
 
  

你可能感兴趣的:(android)