无法从openload播放此视频VideoView

时间:2018-06-19 07:20:16

标签: android surfaceview android-videoview

我将视频上传到 openload ,因此我可以创建网址
然后我将此网址用作 URI VideoView ,但它显示:" 无法播放此视频"
我用VideoView& amp; SurfaceView ,结果一次

XML

namespace TFSGroupMembersFast
{
    class Program
    {
        static Dictionary<IdentityDescriptor, TeamFoundationIdentity> 
        m_identities =
        new Dictionary<IdentityDescriptor, TeamFoundationIdentity> 
        (IdentityDescriptorComparer.Instance);
        static List<TeamFoundationIdentity> m_groups = new 
        List<TeamFoundationIdentity>();
        static string uname;
        static IIdentityManagementService _ims;
        static List<string> grname = new List<string>();
        static void Main(string[] args)
        {
            Console.WriteLine("Enter TFS server or project collection Url");
            Console.Write("e.g. http://localhost:8080/tfs/defaultcollection: ");
            Console.WriteLine();
            string address = Console.ReadLine();
            Console.WriteLine();

            Console.WriteLine("Enter Team Project Uri for project scope, else 
            empty string");
            Console.Write("e.g. vstfs:///Classification/TeamProject/****: ");
            string projectUri = Console.ReadLine();
            Console.WriteLine();
            Console.WriteLine("Enter user name:");
            uname = Console.ReadLine();

            DateTime startTime = DateTime.Now;

            TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(TfsTeamProjectCollection.GetFullyQualifiedUriForName(address));
            _ims = tfs.GetService<IIdentityManagementService>();

            if (string.IsNullOrEmpty(projectUri))
            {
                TeamFoundationIdentity group = 
                _ims.ReadIdentity(GroupWellKnownDescriptors.EveryoneGroup, 
                MembershipQuery.Direct, ReadIdentityOptions.None);
                m_identities[group.Descriptor] = group;
                m_groups.Add(group);

                // Get expanded membership of the Valid Users group, which is all 
                identities in this host             
                group = 
                _ims.ReadIdentity(GroupWellKnownDescriptors.EveryoneGroup, 
                MembershipQuery.Expanded, ReadIdentityOptions.None);
                FetchIdentities(group.Members);
            }
            else
            {
                // Get all groups in this project
                TeamFoundationIdentity[] projectGroups = 
                _ims.ListApplicationGroups(projectUri, ReadIdentityOptions.None);

                Dictionary<IdentityDescriptor, object> descSet = new Dictionary<IdentityDescriptor, object>(IdentityDescriptorComparer.Instance);

                foreach (TeamFoundationIdentity projectGroup in projectGroups)
                {
                    descSet[projectGroup.Descriptor] = projectGroup.Descriptor;
                }

                // Expanded membership of project groups
                projectGroups = _ims.ReadIdentities(descSet.Keys.ToArray(), 
                MembershipQuery.Expanded, ReadIdentityOptions.None);

                // Collect all descriptors
                foreach (TeamFoundationIdentity projectGroup in projectGroups)
                {
                    foreach (IdentityDescriptor mem in projectGroup.Members)
                    {
                        descSet[mem] = mem;
                    }
                }

                FetchIdentities(descSet.Keys.ToArray());
            }

            // Now output groups and their members.
            foreach (TeamFoundationIdentity identity in m_groups)
            {
                Write(identity);
            }

            Console.WriteLine(String.Format("======= Finished reading {0} 
            identities in {1} minutes",
                m_identities.Count, (DateTime.Now - startTime).TotalMinutes));

            for (int i = 0; i < grname.Count; i++)
            {
                Console.WriteLine(grname[i]);
            }
            Console.ReadLine();
        }

        static void FetchIdentities(IdentityDescriptor[] descriptors)
        {
            TeamFoundationIdentity[] identities;

            // If total membership exceeds batch size limit for Read, break it up
            int batchSizeLimit = 100000;

            if (descriptors.Length > batchSizeLimit)
            {
                int batchNum = 0;
                int remainder = descriptors.Length;
                IdentityDescriptor[] batchDescriptors = new 
                IdentityDescriptor[batchSizeLimit];

                while (remainder > 0)
                {
                    int startAt = batchNum * batchSizeLimit;
                    int length = batchSizeLimit;
                    if (length > remainder)
                    {
                        length = remainder;
                        batchDescriptors = new IdentityDescriptor[length];
                    }

                    Array.Copy(descriptors, startAt, batchDescriptors, 0,length);
                    identities = _ims.ReadIdentities(batchDescriptors, 
                    MembershipQuery.Direct, ReadIdentityOptions.None);
                    SortIdentities(identities);
                    remainder -= length;
                }
            }
            else
            {
                identities = _ims.ReadIdentities(descriptors, 
                MembershipQuery.Direct, ReadIdentityOptions.None);
                SortIdentities(identities);
            }
        }

        static void SortIdentities(TeamFoundationIdentity[] identities)
        {
            foreach (TeamFoundationIdentity identity in identities)
            {
                m_identities[identity.Descriptor] = identity;

                if (identity.IsContainer)
                {
                    m_groups.Add(identity);
                }
            }
        }

        static void Write(TeamFoundationIdentity group)
        {
            // Output this group's membership
            Console.WriteLine("Members of group: {0}", group.DisplayName);
            Console.WriteLine("=================");

            foreach (IdentityDescriptor memDesc in group.Members)
            {
                Console.WriteLine(m_identities[memDesc].DisplayName);
                if (m_identities[memDesc].DisplayName == uname)
                {
                    grname.Add(group.DisplayName);

                }
            }
            Console.WriteLine();
        }
    }
}

playVideo方法:

<Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Play"
        android:layout_gravity="top"
        android:onClick="playVideo" />
    <VideoView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/video_view"
        android:layout_margin="4dp"/>

1 个答案:

答案 0 :(得分:0)

您的视频网址必须以文件扩展名

结尾

例如,mydomain.com/sample.mp4