private void initAudioVideo() { Audio = new Audio(); Video = new Video(); Video.FrameReady += Video_FramesReady; Video.RecordComplete += Video_RecordComplete; }
/// <summary> /// 获取频道下的视频信息 /// </summary> /// <param name="channelId">频道ID</param> /// <param name="sort">排序方式,可选值(hot,view,new)</param> /// <param name="offset">偏移值,初次不需要,每次请求会返回下一次请求的偏移值</param> /// <returns>Item1:下次偏移值;Item2:榜一视频(如果有);Item3:视频列表</returns> public async Task <Tuple <string, VideoBase, List <VideoChannel> > > GetChannelVideosAsync(int channelId, string sort = "hot", string offset = "") { var param = new Dictionary <string, string>(); param.Add("channel_id", channelId.ToString()); param.Add("sort", sort); if (!string.IsNullOrEmpty(offset)) { param.Add("offset", offset); } string url = BiliTool.UrlContact(Api.CHANNEL_VIDEO, param, true); string content = await BiliTool.GetTextFromWebAsync(url, true); if (!string.IsNullOrEmpty(content)) { var jobj = JObject.Parse(content); if (jobj["code"].ToString() == "0") { var items = jobj["data"]["items"]; string nextOffset = jobj.SelectToken("data.offset").ToString(); VideoBase rankFirst = null; if (items.First()["goto"].ToString() == "channel_detail_rank") { rankFirst = JsonConvert.DeserializeObject <VideoBase>(items.First().SelectToken("items[0]").ToString()); } var videoList = JsonConvert.DeserializeObject <List <VideoChannel> >(items.ToString()); videoList.RemoveAll(p => p.@goto != "av"); return(new Tuple <string, VideoBase, List <VideoChannel> >(nextOffset, rankFirst, videoList)); } } return(null); }
protected void FormateChannelName(AuthNode plat, VideoBase video) { if (!string.IsNullOrEmpty(plat.FormateName)) { int index = video.Main.Name.LastIndexOf(plat.FormateName); if (index >= 0) { video.ChannelName = video.Main.Name.Substring(0, index); } else { video.ChannelName = video.Main.Name; } } else { video.ChannelName = video.Main.Name; } var v = video as VideoNode; if (v != null) //是点播 { if (!string.IsNullOrEmpty(plat.ReplaceName)) { string[] names = plat.ReplaceName.Split(SplitArray.DHArray, StringSplitOptions.RemoveEmptyEntries); foreach (string n in names) { video.ChannelName = video.ChannelName.Replace(n, ""); } } } }
/// <summary> /// 得到该推荐分类下的频道数 /// </summary> private int GetChannelCount(CoverNavNode node, VideoNodeKey key, CoverFilter filter, List <Func <VideoBase, ExFilterBase, bool> > filters) { int count = 0; if (node.Images.ContainsKey(key)) { var images = node.Images[key]; foreach (var image in images) { var c = CoverImageCache.Instance.Items[image]; var result = true; VideoBase v = null; if (c.ChannelType == 3) { v = ListCache.Instance.Dictionary[c.ChannelId]; } else { v = LiveListCache.Instance.Dictionary[c.ChannelId]; } foreach (var f in filters) { result = result && f(v, filter); } if (result) { count++; } } } return(count); }
public DeviceBase(AudioBase audio, VideoBase video) { _audio = audio; _video = video; _deviceType = DeviceType.NO_DEVICE; _name = "Plug in your Kinect"; }
private void AnimeDownload(argumentList args, int ti, Action <int, string> u) { VideoBase e = new VideoBase(args, ti, u); _base = e; e.BeginExecution(); return; }
private void OnShutdownStarted(object sender, EventArgs e) { if (VideoBase != null) { VideoBase.StopVideo(); } Dispose(); }
public DeviceBase(AudioBase audio, VideoBase video, KinectSensor sensor_xbox360) { _audio = audio; _video = video; sensor = sensor_xbox360; _deviceType = DeviceType.KINECT_1; _name = "K360-" + sensor.UniqueKinectId; }
/// <summary> /// 分页输出 /// </summary> private string CreatePageList(CoverNavNode node, CoverFilter filter, VideoPars pars, List <Func <VideoBase, ExFilterBase, bool> > filters, bool isEx) { var key = new VideoNodeKey(filter.platform, 0, filter.auth); var xml = new XElement("cover_list"); int all = 0; var images = node.Images[key]; for (var i = 0; i < images.Count && all < filter.c; i++) { var image = CoverImageCache.Instance.Items[images[i]]; bool result = true; VideoBase video = null; if (image.ChannelType == 3) { video = ListCache.Instance.Dictionary[image.ChannelId]; } else { video = LiveListCache.Instance.Dictionary[image.ChannelId]; } foreach (var f in filters) { result = result && f(video, filter); } if (!result) { continue; } all++; XElement playlink; if (image.ChannelType == 3) { playlink = VideoResponseUtils.CreateVodPlayLinkVer2(image.ChannelId, filter, isEx); } else { playlink = VideoResponseUtils.CreateLivePlayLinkVer2(image.ChannelId, filter, isEx); } var subttitle = image.Language[filter.lang].SubTitle; if (filter.conlen != 0) { subttitle = subttitle.FormateSubStr(filter.conlen); } xml.Add(new XElement("c", new XElement("title", image.Language[filter.lang].Title), new XElement("note", subttitle), new XElement("vid", image.ChannelId), new XElement("vtype", image.ChannelType == 3 ? "vod" : "live"), playlink, new XElement("cover_imgurl", image.ImageUrl), new XElement("onlinetime", image.OnlineTime.ToString("yyyy-MM-dd HH:mm:ss")) )); } return(xml.ToString(SaveOptions.DisableFormatting)); }
public DeviceBase(AudioBase audio, VideoBase video, String filePath) { _audio = audio; _video = video; _filePath = filePath; _deviceType = DeviceType.RECORD_FILE_KINECT_1; _name = "RF-" + System.IO.Path.GetFileName(_filePath); replay = new KinectReplay(_filePath); replay.ReplayFinished += Replay_ReplayFinished; }
protected void FormateImage(AuthNode plat, VideoBase video) { if (!string.IsNullOrEmpty(plat.FormateImage)) { video.ResImage = video.BKInfo.CoverPic.Replace("75X100", plat.FormateImage); } else { video.ResImage = video.BKInfo.CoverPic; } }
public static void SetForbidden(VideoBase video) { if (!string.IsNullOrEmpty(video.Main.ForbiddenArea)) { video.ForbiddenAreas = video.Main.ForbiddenArea.Split(SplitArray.BlankArray, StringSplitOptions.RemoveEmptyEntries); } else { video.ForbiddenAreas = _noforbidden; } }
private static int PVBaseNum(VideoBase video) { if (video.Hot > 0) { int max = video.Hot; if (max < int.Parse(AppSettingCache.Instance["PVHourNum"])) { max += int.Parse(AppSettingCache.Instance["PVHourNum"]); } return(_random.Next(int.Parse(AppSettingCache.Instance["PVHourNum"]), max) + 1); } else { return(_random.Next(int.Parse(AppSettingCache.Instance["PVHourNum"])) + 1); } }
/// <summary> /// 设置频道码流率标识 /// </summary> public static string SetMark(VideoBase video) { int bit = video.Main.BitRate; if (bit < 400) { return("极速"); } else if (400 <= bit && bit < 600) { return("标清"); } else if (600 <= bit && bit < 900) { return("高清"); } return("蓝光"); }
private async Task RefreshVideo() { var data = await App.BiliViewModel._client.Channel.GetChannelVideosAsync(_channelId, _sortType, _videoOffset); if (data != null) { _videoOffset = data.Item1; if (data.Item2 != null) { _header = data.Item2; HeaderVideoContainer.Visibility = Visibility.Visible; HeaderVideoImage.Source = new BitmapImage(new Uri(_header.GetResolutionCover("400"))); HeaderVideoTitle.Text = _header.title; HeaderVideoPlayCount.Text = _header.cover_left_text_1; } if (data.Item3 != null && data.Item3.Count > 0) { data.Item3.ForEach(p => VideoCollection.Add(p)); } } }
/// <summary> /// 模拟频道的PV人数 /// </summary> public static void SetPV(VideoBase video) { if (video.PV == 0) { int hours = DateTime.Now.Subtract(video.Main.CreateTime).Hours; video.PV = hours * PVBaseNum(video) + PVBaseNum(video); } else { if (_lastpvtime != null && _lastpvtime != DateTime.MinValue) { int hours = DateTime.Now.Subtract(_lastpvtime).Hours; video.PV = video.PV + hours * PVBaseNum(video); } else { video.PV += PVBaseNum(video); } } _lastpvtime = DateTime.Now; }
public IEnumerable <IContent> Search() { var youtubeService = new YouTubeService(new BaseClientService.Initializer() { ApiKey = this.ApiKey, ApplicationName = this.GetType().ToString() }); var searchListRequest = youtubeService.Search.List("snippet"); searchListRequest.Q = Filter; // "love | couple - woman" ===> detailed semantic search searchListRequest.MaxResults = 50; var searchListResponse = searchListRequest.Execute(); List <VideoBase> videos = new List <VideoBase>(); foreach (var searchResult in searchListResponse.Items) { if (searchResult.Id.Kind.Contains("youtube#video") == true) { var video = new VideoBase { ID = searchResult.Id.VideoId, KeyQuery = Filter, Title = searchResult.Snippet.Title, Description = searchResult.Snippet.Description, TrailerURI = string.Format(URL.Trim() + "{0}", searchResult.Id.VideoId), ImageURI = searchResult.Snippet.Thumbnails.High.Url, ReleaseDate = Convert.ToDateTime(searchResult.Snippet.PublishedAt), Rating = SimulatedRating(), SourceType = DataSourceType.YOUTUBE.Description() }; videos.Add(video); } } return(videos); }
public Device(AudioBase audio, VideoBase video) : base(audio, video) { }
public Device(AudioBase audio, VideoBase video, String filePath) : base(audio, video, filePath) { }
public Device(AudioBase audio, VideoBase video, KinectSensor sensor_xbox360) : base(audio, video, sensor_xbox360) { }
protected void FormateImage(VideoBase video) { video.ResImage = video.BKInfo.CoverPic; }
protected void FormateChannelName(VideoBase video) { video.ChannelName = video.Main.Name; }