private string Return_Content_Url(JGN_Videos vd)
        {
            string url = "";

            /*if (vd.pub_url == "Amazon")
             * {
             *  // cloud storage
             *  if (vd.type == 0)
             *  {
             *      // video content
             *      url = "http://s3.amazonaws.com/" + CloudSettings.VideoBucketName + "/" + vd.videofilename;
             *  }
             *  else
             *  {
             *      // audio content
             *      url = "http://s3.amazonaws.com/" + CloudSettings.AudioBuketName + "/" + vd.videofilename;
             *  }
             * }
             * else
             * { */
            // normal
            int ctype = 1;     // published video

            if (vd.type == 0)
            {
                ctype = 1;     // published video file
            }
            else
            {
                ctype = 2;     // audio file
            }
            url = VideoUrlConfig.Return_Video_physicalPath(vd.pub_url, vd.userid, vd.videofilename, ctype);

            // validate content on url
            if (!System.IO.File.Exists(url))
            {
                url = "";
            }
            // }
            return(url);
        }
Exemplo n.º 2
0
        // GET: media
        public async Task <IActionResult> Index(long?pid)
        {
            if (pid == null)
            {
                return(Redirect(Config.GetUrl("videos")));
            }

            var model = new VideoViewModel();

            model.isAllowed = true;

            /*if (HttpContext.Request.Query["status"].Count > 0)
             * {
             *  if (HttpContext.Request.Query["status"] == "pending")
             *      model.Message = SiteConfig.sharedLocalizer["video_message_02"]; // Video has been posted and will be appear shortly.
             * }*/

            var _list = await VideoBLL.LoadItems(_context, new VideoEntity()
            {
                id         = (long)pid,
                ispublic   = false,
                issummary  = false,
                isdropdown = false,
                nofilter   = true
            });

            if (_list.Count == 0)
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.generalLocalizer["_no_records"].Value;
                return(View(model));
            }

            model.Data = _list[0];

            // fetch associated categories
            model.Data.category_list = await CategoryContentsBLL.FetchContentCategoryList(_context, _list[0].id, (byte)CategoryContentsBLL.Types.Videos);

            model.PreviewUrl = VideoUrlConfig.PrepareUrl(model.Data);

            if (model.Data.isadult == (byte)AdultTypes.Adult)
            {
                // 1:-> adult content, 0:-> non adult content
                var getValue = HttpContext.Session.GetString("adultmember");
                if (getValue == null)
                {
                    return(Redirect(Config.GetUrl("home/validateadult?surl=" + WebUtility.UrlEncode(model.PreviewUrl) + "")));
                }
            }

            // premium check
            if (_list[0].isfeatured == (byte)FeaturedTypes.Premium)
            {
                // content is marked as premium
                if (!User.Identity.IsAuthenticated)
                {
                    Response.Redirect(Config.GetUrl("login?ReturnUrl=" + WebUtility.UrlEncode(model.PreviewUrl) + ""), true);
                    return(View(model));
                }
                if (Jugnoon.Settings.Configs.PremiumSettings.premium_option == 1)
                {
                    // check for subscription
                    if (!UserPackagesBLL.Check_membership(_context, SiteConfig.userManager.GetUserName(User)))
                    {
                        // redirect to purchase page
                        Response.Redirect(Config.GetUrl("account/payment/packages?status=noaccess&surl=" + WebUtility.UrlEncode(model.PreviewUrl) + ""));
                        return(View(model));
                    }
                }
                else
                {
                    // credit base purchase view implementation logic required here.
                }
            }

            if (_list[0].isapproved == 0)
            {
                model.Message = SiteConfig.videoLocalizer["_video_pending_status"]; // Video is pending for moderator approval
            }
            if (_list[0].isenabled == (byte)EnabledTypes.Disabled)
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.videoLocalizer["_video_blocked_status"]; // Video has been blocked. contact site administrator for more detail
                return(View(model));
            }

            var _Path = "videos/";

            if (_list[0].type == 1)
            {
                _Path = "audio/";
            }

            model.Info = new InfoViewModel()
            {
                ContentID      = model.Data.id,
                Description    = model.Data.description,
                Created_at     = model.Data.created_at,
                Author         = model.Data.author,
                Category       = model.Data.category_list,
                Tags           = model.Data.tags,
                Liked          = model.Data.liked,
                Disliked       = model.Data.disliked,
                Total_Ratings  = model.Data.total_rating,
                Average_Rating = model.Data.avg_rating,
                MediaType      = model.Data.type,
                Path           = _Path
            };

            // simple view statistics
            _list[0].views = _list[0].views + 1;
            VideoBLL.Update_Field_V3(_context, (long)pid, model.Data.views, "views");

            model.Data.views++;

            // Video Path settings
            string VideoPath   = "";
            string PictureName = "";

            if (model.Data.type == 0)
            {
                // video settings
                // if streamoutputs exist, video transcoded via Elastic Trancoder. It have own setup below.
                if (_list[0].streamoutputs == null || _list[0].streamoutputs == "")
                {
                    VideoPath = VideoUrlConfig.Return_FLV_Video_Url(model.Data.pub_url, model.Data.userid) + "/" + model.Data.videofilename;

                    /*string MP4Path = "";
                     * if (VideoPath.EndsWith(".webm"))
                     *  MP4Path = VideoPath.Replace(".webm", ".mp4");*/
                }

                if (model.Data.thumb_url != "none")
                {
                    PictureName = model.Data.thumb_url;
                }
                else
                {
                    PictureName = VideoUrlConfig.Return_Video_Thumb_Url(model.Data.thumb_url, model.Data.userid) + "/" + model.Data.thumbfilename;
                }
            }
            else
            {
                // audio settings
                VideoPath = VideoUrlConfig.Return_MP3_Audio_Url(model.Data.pub_url, model.Data.userid) + "/" + model.Data.videofilename;
                if (model.Data.thumb_url != "none")
                {
                    PictureName = model.Data.thumb_url;
                }
                else if (_list[0].coverurl.StartsWith("http"))
                {
                    PictureName = _list[0].coverurl;
                }
                else
                {
                    PictureName = VideoUrlConfig.Return_Video_Thumb_Url(model.Data.thumb_url, model.Data.userid) + "/" + model.Data.thumbfilename;
                }
            }


            string _script   = _list[0].embed_script;
            string _videoUrl = "";

            if (_list[0].preview_url != null && _list[0].preview_url != "")
            {
                _videoUrl = _list[0].preview_url;
            }
            else
            {
                _videoUrl = _list[0].pub_url;
            }

            model.Player = new VideoJsModelView()
            {
                EmbedScript = "",
                Type        = model.Data.type
            };

            if (_list[0].coverurl != null && _list[0].coverurl != "")
            {
                model.Player.PictureUrl = _list[0].coverurl;
            }
            else
            {
                model.Player.PictureUrl = PictureName;
            }

            // attach video data with player model
            // useful when you bind some video data within player
            model.Player.Data = _list[0];

            if (model.Data.type == 0)
            {
                // video player settings
                // if AWS Uploader Enabled
                if (_list[0].streamoutputs != null && _list[0].streamoutputs != "")
                {
                    // enabled advance adaptive streaming / mpeg-dash / hls
                    model.Player.enabledAWS = true;
                    model.Player.VideoFeed  = new List <SupportedVideos>();
                    var supportedStreamOptions = _list[0].streamoutputs.Split(char.Parse(","));
                    foreach (var option in supportedStreamOptions)
                    {
                        /*if (option == "mpegdash")
                         * {
                         *  //CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "mpegdash.mpd", 3000),
                         *  model.Player.VideoFeed.Add(new SupportedVideos()
                         *  {
                         *      src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "mpegdash.mpd", 900),
                         *      type = "application/dash+xml"
                         *  });
                         * }
                         *
                         * if (option == "hls")
                         * {
                         *  // CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "hls.m3u8", 3000),
                         *  model.Player.VideoFeed.Add(new SupportedVideos()
                         *  {
                         *      src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "hls.m3u8", 900),
                         *      type = "application/x-mpegURL"
                         *  });
                         * }*/
                        // temporary replace private url with public url
                        var url = _list[0].pub_url.Replace(Jugnoon.Videos.Configs.AwsSettings.private_url, Jugnoon.Videos.Configs.AwsSettings.public_url);
                        if (option == "mp4_480")
                        {
                            model.Player.VideoFeed.Add(new SupportedVideos()
                            {
                                //src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url.Replace("d1fpw0dove1bub.cloudfront.net", "d16gr1zx2upz2x.cloudfront.net") + "menifest_480.mp4",900),
                                src  = url + "menifest_480.mp4",
                                type = "video/mp4"
                            });
                        }
                        // enable hd streaming (make sure it is enabled in AWS Lambda to publish

                        /*if (option == "mp4_720")
                         * {
                         *  model.Player.VideoFeed.Add(new SupportedVideos()
                         *  {
                         *      src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "menifest_720.mp4", 3000),
                         *      type = "video/mp4"
                         *  });
                         * }*/
                    }
                }
                // If cloud enabled
                else if (_script != "" || _list[0].youtubeid != "")
                {
                    // third party embed video script enabled
                    if (_script == "")
                    {
                        model.Player.EmbedScript = _list[0].youtubeid;
                    }
                    else
                    {
                        model.Player.EmbedScript = _script;
                    }
                }
                else if (_videoUrl.StartsWith("http"))
                {
                    // cloud front streaming
                    model.Player.VideoUrl = CloudFront.CreateCannedPrivateURL(_videoUrl, 60);
                }
                else if (_list[0].videofilename.EndsWith("mp4"))
                {
                    if (TokenBLL.isTokenEnabled)
                    {
                        // Token Based Stream Authentication Enabled
                        // Recommended to stream on HTML5 Players
                        string maxParam = VideoBLL.GenerateBandwidthParam();
                        string Token    = TokenBLL.Add(_context);
                        model.Player.VideoUrl = "/stream/token.ashx?f=" + _list[0].videofilename + "&u=" + _list[0].userid + "&tk=" + Token + "" + maxParam;
                        if (_list[0].originalvideofilename.EndsWith(".png"))
                        {
                            model.Player.PictureUrl = "/contents/member/" + _list[0].userid + "/thumbs/" + _list[0].originalvideofilename;
                        }
                    }
                    else if (VideoBLL.EnableHttpStreaming)
                    {
                        // Http Streaming Enabled
                        // Recommended to stream on HTML5 Players
                        string maxParam = VideoBLL.GenerateBandwidthParam();
                        model.Player.VideoUrl = "/stream/stream.ashx?f=" + _list[0].videofilename + "&u=" + _list[0].userid + "" + maxParam;
                    }
                    else
                    {
                        // Direct Play
                        model.Player.VideoUrl = VideoPath;
                    }
                }
                else
                {
                    // load and play videos normally
                    model.Player.VideoUrl = VideoPath;
                }
            }
            else
            {
                // audio player settings
                model.Player.VideoUrl   = VideoPath;
                model.Player.PictureUrl = PictureName;
            }

            model.Action = new ActionViewModel()
            {
                ContentID    = (long)pid,
                Liked        = _list[0].liked,
                Disliked     = _list[0].disliked,
                UserName     = _list[0].userid,
                Favorites    = _list[0].favorites,
                FileName     = model.Data.videofilename,
                VideoPath    = VideoPath,
                isRating     = _list[0].isratings,
                Views        = _list[0].views,
                Comments     = _list[0].comments,
                Content_Type = "video",
                isEmbed      = true,
                MediaType    = model.Data.type,
                Ratingtype   = 1, // 0: like / dislike, 1: rating
                Avg_Ratings  = _list[0].avg_rating,
                Ratings      = _list[0].ratings,
                TotalRatings = _list[0].total_rating,
                isDownload   = false
            };


            model.Comments = new CommentViewModel()
            {
                isComment = _list[0].iscomments
            };

            string meta_title = _list[0].title;

            if (meta_title == "")
            {
                meta_title = "Media No " + _list[0].id;
            }

            string _desc = UtilityBLL.StripHTML(_list[0].description);

            if (_desc == "")
            {
                _desc = _list[0].title;
            }
            else if (_desc.Length > 160)
            {
                _desc = _desc.Substring(0, 160);
            }

            ViewBag.title       = meta_title;
            ViewBag.description = _desc + ", date uploaded: " + _list[0].created_at + ", VID: " + _list[0].id;

            return(View(model));
        }
        public ActionResult published()
        {
            Response.ContentType = "text/plain";

            var json = new StreamReader(Request.Body).ReadToEnd();
            List <VideoFiles> data          = JsonConvert.DeserializeObject <List <VideoFiles> >(json);
            string            publishedPath = VideoUrlConfig.Published_Video_Path(data[0].username);

            var _log = new List <VideoLog>();

            foreach (VideoFiles file in data)
            {
                if (System.IO.File.Exists(publishedPath + "/" + file.filename))
                {
                    // file uploaded successfully.

                    // write code to upload published file to cloud storage e.g amazon s3 here.

                    string ErrorCode = file.errorcode;
                    string fileName  = file.filename; // published filename
                    // rename published file to avoid duplicate issue
                    string newfileName = Guid.NewGuid().ToString().Substring(0, 15) + System.IO.Path.GetExtension(fileName);
                    System.IO.File.Copy(publishedPath + "/" + file.filename, publishedPath + "/" + newfileName);
                    // renmove older file
                    System.IO.File.Delete(publishedPath + "/" + file.filename);

                    string sourcefilename = file.sfle;        // source file name
                    string duration       = file.duration;
                    string durationsec    = file.durationsec; // video duration in seconds

                    // write code to delete original video if not required after publishing
                    if (System.IO.File.Exists(publishedPath + "/" + file.sfle))
                    {
                        System.IO.File.Delete(publishedPath + "/" + file.sfle);
                    }

                    // file operation completed, create log
                    _log.Add(new VideoLog()
                    {
                        errorcode     = file.errorcode,
                        message       = SiteConfig.generalLocalizer["_records_processed"].Value,
                        publishedfile = file.filename,
                        sourcefile    = file.sfle,
                        status        = "success"
                    });
                }
                else
                {
                    // file not found
                    _log.Add(new VideoLog()
                    {
                        errorcode     = file.errorcode,
                        message       = SiteConfig.generalLocalizer["_no_records"].Value,
                        publishedfile = file.filename,
                        sourcefile    = file.sfle,
                        status        = "error"
                    });
                }
            }
            // complete published operation
            var _report = new PublishedReport()
            {
                status  = "success",
                message = SiteConfig.generalLocalizer["_records_processed"].Value,
                report  = _log
            };

            return(Ok(_report));
        }
        public async Task <IActionResult> upload()
        {
            if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
            {
                return(BadRequest($"Expected a multipart request, but got {Request.ContentType}"));
            }

            StringValues UserName;

            SiteConfig.HttpContextAccessor.HttpContext.Request.Headers.TryGetValue("UName", out UserName);

            // Used to accumulate all the form url encoded key value pairs in the
            // request.
            var formAccumulator = new KeyValueAccumulator();
            // string targetFilePath = null;

            var boundary = MultipartRequestHelper.GetBoundary(
                MediaTypeHeaderValue.Parse(Request.ContentType),
                _defaultFormOptions.MultipartBoundaryLengthLimit);

            var reader = new MultipartReader(boundary, HttpContext.Request.Body);

            var section = await reader.ReadNextSectionAsync();

            var uploadPath = SiteConfig.Environment.ContentRootPath + UtilityBLL.ParseUsername(DirectoryPaths.UserVideosDefaultDirectoryPath, UserName.ToString());

            if (!Directory.Exists(uploadPath))
            {
                Directory_Process.CreateRequiredDirectories(SiteConfig.Environment.ContentRootPath + UtilityBLL.ParseUsername(SystemDirectoryPaths.UserDirectory, UserName.ToString()));
            }

            /*if (!Directory.Exists(uploadPath))
             * {
             *  return Ok(new { jsonrpc = "2.0", result = "Error", fname = uploadPath, message = "Main Directory Not Exist" });
             * }
             *
             * if (!Directory.Exists(uploadPath + "default/"))
             * {
             *  return Ok(new { jsonrpc = "2.0", result = "Error", fname = uploadPath + "default/", message = "Default Directory Not Exist" });
             * }*/

            var fileName = "";

            try
            {
                while (section != null)
                {
                    ContentDispositionHeaderValue contentDisposition;
                    var hasContentDispositionHeader = ContentDispositionHeaderValue.TryParse(section.ContentDisposition,
                                                                                             out contentDisposition);

                    if (hasContentDispositionHeader)
                    {
                        if (MultipartRequestHelper.HasFileContentDisposition(contentDisposition))
                        {
                            var output = formAccumulator.GetResults();
                            var chunk  = "0";
                            foreach (var item in output)
                            {
                                if (item.Key == "name")
                                {
                                    fileName = item.Value;
                                }
                                else if (item.Key == "chunk")
                                {
                                    chunk = item.Value;
                                }
                            }

                            var Path = uploadPath + "" + fileName;
                            using (var fs = new FileStream(Path, chunk == "0" ? FileMode.Create : FileMode.Append))
                            {
                                await section.Body.CopyToAsync(fs);

                                fs.Flush();
                            }
                        }
                        else if (MultipartRequestHelper.HasFormDataContentDisposition(contentDisposition))
                        {
                            var key      = HeaderUtilities.RemoveQuotes(contentDisposition.Name);
                            var encoding = GetEncoding(section);
                            using (var streamReader = new StreamReader(
                                       section.Body,
                                       encoding,
                                       detectEncodingFromByteOrderMarks: true,
                                       bufferSize: 1024,
                                       leaveOpen: true))
                            {
                                // The value length limit is enforced by MultipartBodyLengthLimit
                                var value = await streamReader.ReadToEndAsync();

                                if (String.Equals(value, "undefined", StringComparison.OrdinalIgnoreCase))
                                {
                                    value = String.Empty;
                                }
                                formAccumulator.Append(key.ToString(), value);

                                if (formAccumulator.ValueCount > _defaultFormOptions.ValueCountLimit)
                                {
                                    throw new InvalidDataException($"Form key count limit {_defaultFormOptions.ValueCountLimit} exceeded.");
                                }
                            }
                        }
                    }

                    var result = formAccumulator.GetResults();

                    // Drains any remaining section body that has not been consumed and
                    // reads the headers for the next section.
                    section = await reader.ReadNextSectionAsync();
                }
            }
            catch (Exception ex)
            {
                return(Ok(new { jsonrpc = "2.0", result = "Error", fname = uploadPath, message = ex.Message }));
            }


            string url       = VideoUrlConfig.Source_Video_Url(UserName.ToString()) + "/" + fileName;
            string fileType  = System.IO.Path.GetExtension(fileName);
            string fileIndex = fileName.Replace(fileType, "");

            return(Ok(new { jsonrpc = "2.0", result = "OK", fname = fileName, url = url, filetype = fileType, filename = fileName, fileIndex = fileIndex }));
        }
Exemplo n.º 5
0
        // GET: media
        public async Task <IActionResult> Index(long?pid)
        {
            var model = new VideoFrameViewModel();

            model.isAllowed = true;
            if (pid == null)
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.generalLocalizer["_no_records"].Value;
                return(View(model));
            }

            var _list = await VideoBLL.LoadItems(_context, new VideoEntity()
            {
                id         = (long)pid,
                ispublic   = false,
                issummary  = false,
                isdropdown = false,
                nofilter   = true
            });

            if (_list.Count == 0)
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.generalLocalizer["_no_records"].Value;
                return(View(model));
            }

            model.Data = _list[0];

            if (_list[0].isapproved == (byte)ApprovedTypes.Disabled)
            {
                model.Message = SiteConfig.videoLocalizer["_video_pending_status"].Value;
            }
            if (_list[0].isenabled == (byte)EnabledTypes.Disabled)
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.videoLocalizer["_video_blocked_status"].Value;
                return(View(model));
            }

            // simple view statistics
            _list[0].views = _list[0].views + 1;
            VideoBLL.Update_Field_V3(_context, (long)pid, model.Data.views, "views");

            model.Data.views++;

            // Video Path settings
            string VideoPath   = "";
            string PictureName = "";


            if (model.Data.type == 0)
            {
                // video settings
                // if streamoutputs exist, video transcoded via Elastic Trancoder. It have own setup below.
                if (_list[0].streamoutputs == null || _list[0].streamoutputs == "")
                {
                    VideoPath = VideoUrlConfig.Return_FLV_Video_Url(model.Data.pub_url, model.Data.userid) + "/" + model.Data.videofilename;

                    /*string MP4Path = "";
                     * if (VideoPath.EndsWith(".webm"))
                     *  MP4Path = VideoPath.Replace(".webm", ".mp4");*/
                }

                if (model.Data.thumb_url != "none")
                {
                    PictureName = model.Data.thumb_url;
                }
                else
                {
                    PictureName = VideoUrlConfig.Return_Video_Thumb_Url(model.Data.thumb_url, model.Data.userid) + "/" + model.Data.thumbfilename;
                }
            }
            else
            {
                // audio settings
                VideoPath = VideoUrlConfig.Return_MP3_Audio_Url(model.Data.pub_url, model.Data.userid) + "/" + model.Data.videofilename;
                if (model.Data.thumb_url != "none")
                {
                    PictureName = model.Data.thumb_url;
                }
                else if (_list[0].coverurl.StartsWith("http"))
                {
                    PictureName = _list[0].coverurl;
                }
                else
                {
                    PictureName = VideoUrlConfig.Return_Video_Thumb_Url(model.Data.thumb_url, model.Data.userid) + "/" + model.Data.thumbfilename;
                }
            }

            string _script   = _list[0].embed_script;
            string _videoUrl = "";

            if (_list[0].preview_url != null && _list[0].preview_url != "")
            {
                _videoUrl = _list[0].preview_url;
            }
            else
            {
                _videoUrl = _list[0].pub_url;
            }

            model.Player = new VideoJsModelView()
            {
                EmbedScript = "",
                Type        = model.Data.type
            };

            if (_list[0].coverurl != null && _list[0].coverurl != "")
            {
                model.Player.PictureUrl = _list[0].coverurl;
            }
            else
            {
                model.Player.PictureUrl = PictureName;
            }

            // attach video data with player model
            // useful when you bind some video data within player
            model.Player.Data = _list[0];

            if (model.Data.type == 0)
            {
                // video player settings
                // if AWS Uploader Enabled
                if (_list[0].streamoutputs != null && _list[0].streamoutputs != "")
                {
                    // enabled advance adaptive streaming / mpeg-dash / hls
                    model.Player.enabledAWS = true;
                    model.Player.VideoFeed  = new List <SupportedVideos>();
                    var supportedStreamOptions = _list[0].streamoutputs.Split(char.Parse(","));
                    foreach (var option in supportedStreamOptions)
                    {
                        /*if (option == "mpegdash")
                         * {
                         *  //CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "mpegdash.mpd", 3000),
                         *  model.Player.VideoFeed.Add(new SupportedVideos()
                         *  {
                         *      src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "mpegdash.mpd", 900),
                         *      type = "application/dash+xml"
                         *  });
                         * }
                         *
                         * if (option == "hls")
                         * {
                         *  // CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "hls.m3u8", 3000),
                         *  model.Player.VideoFeed.Add(new SupportedVideos()
                         *  {
                         *      src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "hls.m3u8", 900),
                         *      type = "application/x-mpegURL"
                         *  });
                         * }*/
                        if (option == "mp4_480")
                        {
                            model.Player.VideoFeed.Add(new SupportedVideos()
                            {
                                //src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url.Replace("d1fpw0dove1bub.cloudfront.net", "d16gr1zx2upz2x.cloudfront.net") + "menifest_480.mp4",900),
                                src  = _list[0].pub_url.Replace(Jugnoon.Videos.Configs.AwsSettings.private_url, Jugnoon.Videos.Configs.AwsSettings.public_url) + "menifest_480.mp4",
                                type = "video/mp4"
                            });
                        }
                        // enable hd streaming (make sure it is enabled in AWS Lambda to publish

                        /*if (option == "mp4_720")
                         * {
                         *  model.Player.VideoFeed.Add(new SupportedVideos()
                         *  {
                         *      src = CloudFront.CreateCannedPrivateURL(_list[0].pub_url + "menifest_720.mp4", 3000),
                         *      type = "video/mp4"
                         *  });
                         * }*/
                    }
                }
                // If cloud enabled
                else if (_script != "" || _list[0].youtubeid != "")
                {
                    // third party embed video script enabled
                    if (_script == "")
                    {
                        model.Player.EmbedScript = _list[0].youtubeid;
                    }
                    else
                    {
                        model.Player.EmbedScript = _script;
                    }
                }
                else if (_videoUrl.StartsWith("http"))
                {
                    // cloud front streaming
                    model.Player.VideoUrl = CloudFront.CreateCannedPrivateURL(_videoUrl, 60);
                }
                else if (_list[0].videofilename.EndsWith("mp4"))
                {
                    if (TokenBLL.isTokenEnabled)
                    {
                        // Token Based Stream Authentication Enabled
                        // Recommended to stream on HTML5 Players
                        string maxParam = VideoBLL.GenerateBandwidthParam();
                        string Token    = TokenBLL.Add(_context);
                        model.Player.VideoUrl = "/stream/token.ashx?f=" + _list[0].videofilename + "&u=" + _list[0].userid + "&tk=" + Token + "" + maxParam;
                        if (_list[0].originalvideofilename.EndsWith(".png"))
                        {
                            model.Player.PictureUrl = "/contents/member/" + _list[0].userid + "/thumbs/" + _list[0].originalvideofilename;
                        }
                    }
                    else if (VideoBLL.EnableHttpStreaming)
                    {
                        // Http Streaming Enabled
                        // Recommended to stream on HTML5 Players
                        string maxParam = VideoBLL.GenerateBandwidthParam();
                        model.Player.VideoUrl = "/stream/stream.ashx?f=" + _list[0].videofilename + "&u=" + _list[0].userid + "" + maxParam;
                    }
                    else
                    {
                        // Direct Play
                        model.Player.VideoUrl = VideoPath;
                    }
                }
                else
                {
                    // load and play videos normally
                    model.Player.VideoUrl = VideoPath;
                }
            }
            else
            {
                // audio player settings
                model.Player.VideoUrl   = VideoPath;
                model.Player.PictureUrl = PictureName;
            }

            string meta_title = _list[0].title;

            if (meta_title == "")
            {
                meta_title = "Media No " + _list[0].id;
            }

            string _desc = UtilityBLL.StripHTML(_list[0].description);

            if (_desc == "")
            {
                _desc = _list[0].title;
            }
            else if (_desc.Length > 160)
            {
                _desc = _desc.Substring(0, 160);
            }

            ViewBag.title       = meta_title;
            ViewBag.description = _desc + ", date uploaded: " + _list[0].created_at + ", VID: " + _list[0].id;

            return(View(model));
        }