当前位置: 首页>>代码示例>>C#>>正文


C# VideoInfo类代码示例

本文整理汇总了C#中VideoInfo的典型用法代码示例。如果您正苦于以下问题:C# VideoInfo类的具体用法?C# VideoInfo怎么用?C# VideoInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VideoInfo类属于命名空间,在下文中一共展示了VideoInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetVideoUrl

        public override string GetVideoUrl(VideoInfo video)
        {
            string webdata = GetWebData(video.VideoUrl);
            var doc = new HtmlDocument();
            doc.LoadHtml(webdata);
            var node = doc.DocumentNode.SelectSingleNode(@"//div[@data-media]");
            string js = HttpUtility.HtmlDecode(node.Attributes["data-media"].Value);
            JToken data = JObject.Parse(js) as JToken;
            JToken sources = data["sources"];
            video.PlaybackOptions = new Dictionary<string, string>();
            AddOption("high", sources, video.PlaybackOptions);
            AddOption("web", sources, video.PlaybackOptions);
            AddOption("mobile", sources, video.PlaybackOptions);

            if (video.PlaybackOptions.Count == 0) return null;
            else
                if (video.PlaybackOptions.Count == 1)
                {
                    string resultUrl = video.PlaybackOptions.First().Value;
                    video.PlaybackOptions = null;// only one url found, PlaybackOptions not needed
                    return resultUrl;
                }
                else
                {
                    return video.PlaybackOptions.First().Value;
                }
        }
开发者ID:offbyoneBB,项目名称:mp-onlinevideos2,代码行数:27,代码来源:RTBFUtil.cs

示例2: Video

 /// <summary>
 /// 
 /// </summary>
 /// <param name="src">视频源文件</param>
 public Video(string src)
 {
     if (!System.IO.File.Exists(src))
         throw new Exception(src + " Not Found.");
     _Source = src;
     Info = MediaHelper.GetVideoInfo(src);
 }
开发者ID:CodeComb,项目名称:Media,代码行数:11,代码来源:Video.cs

示例3: GetVideos

        public override List<VideoInfo> GetVideos(Category category)
        {
            string webdata = GetWebData(((RssLink)category).Url);
            var doc = new HtmlDocument();
            doc.LoadHtml(webdata);

            List<VideoInfo> res = new List<VideoInfo>();
            var vidnodes = doc.DocumentNode.SelectNodes(@".//section[@class='js-item-container']//article");
            foreach (var vidnode in vidnodes)
                if (vidnode.Attributes["data-id"] != null)
                {
                    VideoInfo video = new VideoInfo();
                    video.Title = vidnode.SelectSingleNode(@"./header/h3/a").InnerText;
                    var tmNode = vidnode.SelectSingleNode(@".//time");
                    if (tmNode != null)
                        video.Airdate = tmNode.InnerText;
                    video.VideoUrl = @"http://www.rtbf.be/auvio/embed/media?id=" + vidnode.Attributes["data-id"].Value;
                    string img = vidnode.SelectSingleNode(@".//img").Attributes["data-srcset"].Value;
                    var arr1 = img.Split(',');
                    var arr2 = arr1.Last<string>().Split(' ');
                    video.Thumb = arr2[0];

                    res.Add(video);
                }
            return res;
        }
开发者ID:offbyoneBB,项目名称:mp-onlinevideos2,代码行数:26,代码来源:RTBFUtil.cs

示例4: GetVideoUrl

        public override string GetVideoUrl(VideoInfo video)
        {
            string res = base.GetVideoUrl(video);
            XmlDocument doc = new XmlDocument();
            string[] urlParts = video.VideoUrl.Split('.');

            if (urlParts[1] == "four")
                res = res.Replace("@@", "c4");
            else
                res = res.Replace("@@", "tv3");

            doc.Load(res);

            video.PlaybackOptions = new Dictionary<string, string>();

            string meta_base = @"rtmpe://202.49.175.79/vod/_definst_"; // found with wireshark. apparently value in 
            //meta/base (rtmpe://vod-geo.mediaworks.co.nz/vod/_definst_) is just a decoy

            //old: doc.SelectSingleNode("//smil/head/meta").Attributes["base"].Value;

            foreach (XmlNode node in doc.SelectNodes("//smil/body/switch/video"))
            {
                int bitRate = int.Parse(node.Attributes["system-bitrate"].Value) / 1024;

                RtmpUrl rtmpUrl = new RtmpUrl(meta_base + "/" + node.Attributes["src"].Value)
                {
                    SwfVerify = true,
                    SwfUrl = @"http://static.mediaworks.co.nz/video/jw/6.50/jwplayer.flash.swf"
                };

                video.PlaybackOptions.Add(bitRate.ToString() + "K", rtmpUrl.ToString());
            }

            return video.PlaybackOptions.Last().Value;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:35,代码来源:TV3NZOnDemandUtil.cs

示例5: VideoPage

 /******************************************/
 /******************************************/
 /// <summary>内部生成時、使用される</summary>
 /// <param name="Target">ターゲット動画</param>
 /// <param name="Host">生成元</param>
 /// <param name="Context">コンテキスト</param>
 internal VideoPage(VideoInfo Target, VideoService Host, Context Context)
 {
     target = Target;
     host = Host;
     context = Context;
     converter = new Serial.Converter(context);
 }
开发者ID:cocop,项目名称:NicoServiceAPI,代码行数:13,代码来源:VideoPage.cs

示例6: GetVideoUrl

        public override string GetVideoUrl(VideoInfo video)
        {
            var json = JObject.Parse(Regex.Match(GetWebData(video.VideoUrl), "var info = (?<json>{.*),").Groups["json"].Value);

            video.PlaybackOptions = new Dictionary<string,string>();
            
            var url = json.Value<string>("stream_h264_ld_url");
            if (!string.IsNullOrEmpty(url))
                video.PlaybackOptions.Add("Low - 320x240", url);
            
            url = json.Value<string>("stream_h264_url");
            if (!string.IsNullOrEmpty(url))
                video.PlaybackOptions.Add("Normal - 512x384", url);

            url = json.Value<string>("stream_h264_hq_url");
            if (!string.IsNullOrEmpty(url))
                video.PlaybackOptions.Add("High - 848x480", url);

            url = json.Value<string>("stream_h264_hd_url");
            if (!string.IsNullOrEmpty(url))
                video.PlaybackOptions.Add("HD - 1280x720", url);

            url = json.Value<string>("stream_h264_hd1080_url");
            if (!string.IsNullOrEmpty(url))
                video.PlaybackOptions.Add("Full HD - 1920x1080", url);

            return video.PlaybackOptions.Last().Value;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:28,代码来源:DailyMotionUtil.cs

示例7: GetInfo

        public VideoInfo GetInfo( string playUrl )
        {
            VideoInfo vi = new VideoInfo();
            vi.PlayUrl = playUrl;

            try {

                String pageBody = PageLoader.Download( playUrl );

                Match mt = Regex.Match( pageBody, "video : {(" + "." + "+?)\\}[^,]", RegexOptions.Singleline );
                String strJson = "{" + mt.Groups[1].Value + "}";

                Dictionary<String, Object> dic = JSON.ToDictionary( strJson );

                vi.PicUrl = dic.ContainsKey( "pic" ) ? dic["pic"].ToString() : "";
                vi.FlashUrl = dic.ContainsKey( "swfOutsideUrl" ) ? dic["swfOutsideUrl"].ToString() : "";
                vi.Title = dic.ContainsKey( "title" ) ? dic["title"].ToString() : "";

                return vi;

            }
            catch (Exception ex) {

                logger.Error( "getUrl=" + playUrl );
                logger.Error( ex.Message );

                return vi;
            }
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:29,代码来源:SinaVideo.cs

示例8: GetVideoPage

 /// <summary>動画へアクセスするページを取得する</summary>
 /// <param name="Target">ターゲット動画</param>
 public VideoPage GetVideoPage(VideoInfo Target)
 {
     if (Target.videoPage != null)
         return Target.videoPage;
     else
         return Target.videoPage = new VideoPage(Target, context);
 }
开发者ID:cocop,项目名称:UNicoAPI2,代码行数:9,代码来源:VideoServicePage.cs

示例9: UploadFile

    private void UploadFile(string filetype)
    {
        if (filetype == "VIDEO") //TODO:CONFIG
            RadUpload1.TargetFolder = ConfigurationManager.AppSettings["VideoUploadPath"].ToString(); //TODO:CONFIG
        if (filetype == "AUDIO") //TODO:CONFIG
            RadUpload1.TargetFolder = ConfigurationManager.AppSettings["AudioUploadPath"].ToString(); //TODO:CONFIG
        if (filetype != "")
        {
            string path = string.Empty;
            string name = hdnName.Value;
            string fn = System.IO.Path.GetFileName(name);
            string extension = fn.Substring(fn.IndexOf("."));
            string savefile = Guid.NewGuid().ToString() + extension;
            string SaveLocation = path + savefile;
            //FileUpload.PostedFile.SaveAs(SaveLocation);
            //Session["FileName"] = savefile;
            WebClient Client = new WebClient();
            //RadUpload1.AllowedFileExtensions = {'.flv'};
            //Client.UploadFile(Server.MapPath(RadUpload1.TargetFolder) + savefile, name);
            Client.UploadFile(RadUpload1.TargetFolder + savefile, name);
            //Session.Remove("PostedFile");

            //Make database entry.
            //if (FilePathFileUpload.HasFile)
            //{
            VideoInfo entity = new VideoInfo();
            //string appPath = Server.MapPath(ConfigurationManager.AppSettings.Get("VideoUploadPath"));
            //string extension = FilePathFileUpload.PostedFile.FileName.Substring(FilePathFileUpload.PostedFile.FileName.LastIndexOf("."));
            //entity.FilePath = System.Guid.NewGuid().ToString() + extension;
            //FilePathFileUpload.SaveAs(appPath + entity.FilePath);
            //if (Session["FileName"] != null)
            if (savefile != "")
            {
                //entity.FilePath = Session["FileName"].ToString();
                //Session["FileName"] = null;
                entity.FilePath = savefile;
            }
            entity.ClassId = this.ClassId;
            entity.Title = TitleTextBox.Text;
            entity.Description = DescriptionTextBox.Value;
            //entity.Speakers = SpeakerTextBox.Text;
            entity.Visible = VisibleCheckBox.Checked;
            entity.CreatedTimestamp = DateTime.Now;
            entity.UpdatedTimestamp = DateTime.Now;

            bool result = VideoInfo.InsertVideo(ref entity);

            if (result)
            {
                //CreateVideoDialog.Reset();
                DataBind();
                OnVideoCreated(EventArgs.Empty);
                entity = null;
                //Session.Remove("FileName");
                Response.Redirect(this.Page.Request.Url.AbsoluteUri);
            }
        }


    }
开发者ID:IdeaFortune,项目名称:Monaco,代码行数:60,代码来源:CreateVideoDialog.ascx.cs

示例10: DoGetSubtitles

        protected override List<SubtitleInfo> DoGetSubtitles(VideoInfo vi)
        {
            List<SubtitleInfo> retVal = new List<SubtitleInfo>();

            SearchResult res = _wsdl.searchSubtitles(_sessionToken, vi.moviehash, (long)vi.moviebytesize, vi.sublanguageid, vi.imdbid);
            if (res.data != null && res.data.Length > 0)
            {
                foreach (SubtitleData sd in res.data)
                {
                    SubtitleInfo si = new SubtitleInfo();

                    si.IDSubtitleFile = sd.subID.ToString();
                    si.SubFileName = sd.subName;
                    si.MovieName = sd.movieName;
                    si.SubHash = sd.subHash;

                    si.LanguageName = OPMedia.Core.Language.ThreeLetterISOLanguageNameToEnglishName(sd.subLang);

                    si.MovieHash = vi.moviehash;
                    si.SubDownloadLink = sd.subDownloadLink;
                    si.SubFormat = sd.subFormat;

                    retVal.Add(si);
                }
            }

            return retVal;
        }
开发者ID:rraguso,项目名称:protone-suite,代码行数:28,代码来源:BspV1Session.cs

示例11: GetInfo

        public VideoInfo GetInfo( String url )
        {
            String vid = strUtil.TrimStart( url, "http://v.ku6.com/show/" );
            vid = strUtil.TrimEnd( vid, ".html" );

            String flashUrl = string.Format( "http://player.ku6.com/refer/{0}/v.swf", vid );

            VideoInfo vi = new VideoInfo();
            vi.PlayUrl = url;
            vi.FlashUrl = flashUrl;
            vi.FlashId = vid;

            try {
                String pageBody = PageLoader.Download( url );

                Match mt = Regex.Match( pageBody, "<title>([^<]+?)</title>" );
                String title = VideoHelper.GetTitle( mt.Groups[1].Value );

                Match m = Regex.Match( pageBody, "<span class=\"s_pic\">([^<]+?)</span>" );
                String picUrl = m.Groups[1].Value;

                vi.Title = title;
                vi.PicUrl = picUrl;

                return vi;
            }
            catch (Exception ex) {
                logger.Error( "getUrl=" + url );
                logger.Error( ex.Message );
                return vi;
            }
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:32,代码来源:Ku6Spider.cs

示例12: GetVideos

        public override List<VideoInfo> GetVideos(Category category)
        {
            List<VideoInfo> listVideos = new List<VideoInfo>();
            string url = (category as RssLink).Url;
            string webData = GetWebData((category as RssLink).Url);

            Regex r = new Regex(@"href=""(?<url>[^""]*)""></a><span\sclass=""play_video""></span>\s*<img\ssrc=""(?<thumb>[^""]*)""\swidth=""120""\sheight=""90""\salt=""""\s/>\s*</div>\s*<p>\s*<strong>(?<title>[^<]*)</strong>\s*<span>(?<description>[^<]*)<br/>(?<description2>[^<]*)</span>\s*</p>",
                    RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture);

            Match m = r.Match(webData);
            while (m.Success)
            {
                VideoInfo video = new VideoInfo()
                {
                    VideoUrl = m.Groups["url"].Value,
                    Title = m.Groups["title"].Value,
                    Thumb = m.Groups["thumb"].Value,
                    Description = m.Groups["description"].Value.Trim() + "\n" + m.Groups["description2"].Value.Trim()
                };

                listVideos.Add(video);
                m = m.NextMatch();
            }

            return listVideos;
        }
开发者ID:flanagan-k,项目名称:mp-onlinevideos2,代码行数:26,代码来源:GulliUtil.cs

示例13: TryReadVideoInfoViaAviHeader

        public static VideoInfo TryReadVideoInfoViaAviHeader(string fileName)
        {
            var info = new VideoInfo { Success = false };

            try
            {
                using (var rp = new RiffParser())
                {
                    if (rp.TryOpenFile(fileName) && rp.FileType == RiffParser.ckidAVI)
                    {
                        var dh = new RiffDecodeHeader(rp);
                        dh.ProcessMainAVI();
                        info.FileType = RiffParser.FromFourCC(rp.FileType);
                        info.Width = dh.Width;
                        info.Height = dh.Height;
                        info.FramesPerSecond = dh.FrameRate;
                        info.TotalFrames = dh.TotalFrames;
                        info.TotalMilliseconds = dh.TotalMilliseconds;
                        info.TotalSeconds = info.TotalMilliseconds / TimeCode.BaseUnit;
                        info.VideoCodec = dh.VideoHandler;
                        info.Success = true;
                    }
                }
            }
            catch
            {
            }
            return info;
        }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:29,代码来源:Utilities.cs

示例14: ProcessVideo

        public static bool ProcessVideo(VideoInfo videoInfoInput, bool rmSound)
        {
            WebClient webClient = new WebClient();
            videoInfo = videoInfoInput;
            removeSound = rmSound;
            logger.Info("videoinfo.filename " + videoInfo.Filename + "\n" + videoInfoInput.Filename);

            filepath = PATH + videoInfo.Filename;

            logger.Info("Server.MapPath(..\\) + filename: " + filepath);
            if (Path.HasExtension(filepath) == false)
                filepath += ".mp4"; // todo change to .mp4
            else
                filepath = Path.ChangeExtension(filepath, "mp4"); // download as mp4 extension
            logger.Info("Download video: " + filepath);
            try
            {
                webClient.DownloadFileCompleted += DownloadCompleted;
                webClient.DownloadFileAsync(new Uri(videoInfo.DownloadUrl), filepath);
                Timer t = new Timer();
                t.Start();
                t.Interval = DownloadTimeout;
                t.Elapsed += delegate { webClient.CancelAsync(); };
            }
            catch (WebException ex)
            {
                logger.Error(ex.Status);
                logger.Error(ex.Response);
            }

            return false;
        }
开发者ID:gman1023,项目名称:video-to-wikipedia,代码行数:32,代码来源:VideoDownloader.cs

示例15: SearchSubtitles

 public OsdbSearchSubtitleResponse SearchSubtitles(string token, VideoInfo[] videoInfoList)
 {
     lock (SyncRoot)
     {
         return _proxy.SearchSubtitles(token, videoInfoList);
     }
 }
开发者ID:rraguso,项目名称:protone-suite,代码行数:7,代码来源:OsdbConnection.cs


注:本文中的VideoInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。