public ActionResult DeleteConfirmed(int id) { YoutubeLiveDetail youtubelivedetail = db.YoutubeLiveDetails.Find(id); db.YoutubeLiveDetails.Remove(youtubelivedetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Transition([Bind(Include = "Id,CourseId,BroadcastId,BroadcastKind,BroadcastTitle,BroadcastDescription,BroadcastScheduledStartTime,BroadcastScheduledEndTime,BroadcastStatus,BroadcastchannelId,BroadcastlifeCycleStatus,BroadcastEmbededhtml,StreamId,StreamKind,StreamName,StreamStatus,StreamSnippetTitle,StreamCDNFormat,StreamCDNIngestionType,StreamCDNIngestionUrl,StreamcontentclosedCaptionsIngestionUrl")] YoutubeLiveDetail youtubelivedetail) { if (ModelState.IsValid) { db.Entry(youtubelivedetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Title", youtubelivedetail.CourseId); return(View(youtubelivedetail)); }
public async Task <ActionResult> Create([Bind(Include = "Id,CourseId,BroadcastId,BroadcastKind,BroadcastTitle,BroadcastDescription,BroadcastScheduledStartTime,BroadcastScheduledEndTime,BroadcastStatus,BroadcastchannelId,BroadcastlifeCycleStatus,BroadcastEmbededhtml,StreamId,StreamKind,StreamName,StreamStatus,StreamSnippetTitle,StreamCDNFormat,StreamCDNIngestionType,StreamCDNIngestionUrl,StreamcontentclosedCaptionsIngestionUrl")] YoutubeLiveDetail youtubelivedetail) { BroadcastController liveController = new BroadcastController(); youtubelivedetail.StreamCDNIngestionType = "rtmp"; youtubelivedetail.BroadcastKind = "youtube#liveBroadcast"; youtubelivedetail.StreamKind = "youtube#liveStream"; // Create broadcast and stream for YoutubeLive LiveBroadcast broadcast = await liveController.createBroadcast(youtubelivedetail.BroadcastKind, youtubelivedetail.BroadcastTitle, youtubelivedetail.BroadcastScheduledStartTime, youtubelivedetail.BroadcastScheduledEndTime, youtubelivedetail.BroadcastStatus); LiveStream stream = await liveController.createStream(youtubelivedetail.StreamKind, youtubelivedetail.StreamSnippetTitle, youtubelivedetail.StreamCDNFormat, youtubelivedetail.StreamCDNIngestionType); // Bind them together LiveBroadcast bindedBroadcast = await liveController.bindBroadcast(broadcast, stream); // Values to-be inserted updated youtubelivedetail.BroadcastId = bindedBroadcast.Id; youtubelivedetail.BroadcastchannelId = bindedBroadcast.ContentDetails.BoundStreamId; youtubelivedetail.StreamName = stream.Cdn.IngestionInfo.StreamName; youtubelivedetail.StreamStatus = stream.Status.StreamStatus; youtubelivedetail.StreamId = stream.Id; youtubelivedetail.StreamCDNIngestionUrl = stream.Cdn.IngestionInfo.IngestionAddress; String id = (bindedBroadcast.ContentDetails.MonitorStream.EmbedHtml).ToString(); YouTubeService youtube = new YouTubeService(await(new GoogleAuthentication()).GetInitializer()); bindedBroadcast.ContentDetails.MonitorStream.EnableMonitorStream = false; LiveBroadcastsResource.UpdateRequest disablePreview = youtube.LiveBroadcasts.Update(bindedBroadcast, "contentDetails"); LiveBroadcast returnBroadcast = disablePreview.Execute(); //substring for browser if (id.Contains("embed/")) { int startIndex = id.IndexOf("embed/"); int endIndex = id.IndexOf("?"); id = id.Substring(startIndex + 6, (endIndex - (startIndex + 6))); } youtubelivedetail.BroadcastEmbededhtml = id; //BroadCastID for Player if (ModelState.IsValid) { db.YoutubeLiveDetails.Add(youtubelivedetail); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Title", youtubelivedetail.CourseId); return(View(youtubelivedetail)); }
// GET: /Youtube/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } YoutubeLiveDetail youtubelivedetail = db.YoutubeLiveDetails.Find(id); if (youtubelivedetail == null) { return(HttpNotFound()); } return(View(youtubelivedetail)); }
// GET: /Youtube/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } YoutubeLiveDetail youtubelivedetail = db.YoutubeLiveDetails.Find(id); if (youtubelivedetail == null) { return(HttpNotFound()); } ViewBag.BroadcastEmbededhtml = youtubelivedetail.BroadcastEmbededhtml; return(View(youtubelivedetail)); }
// GET: /Youtube/Edit/5 public ActionResult Transition(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } YoutubeLiveDetail youtubelivedetail = db.YoutubeLiveDetails.Find(id); if (youtubelivedetail == null) { return(HttpNotFound()); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Title", youtubelivedetail.CourseId); return(View(youtubelivedetail)); }