Ejemplo n.º 1
0
 public VideoClip PlayVideo(string video, bool isInside, VideoPlayer player, RawImage image, int width = 1920, int height = 1080)
 {
     player.targetTexture = new RenderTexture(width, height, 0);
     if (VideoExist(video))
     {
         VideoClip clip = GetVideoClip(video);
         player.source = VideoSource.VideoClip;
         player.clip = clip;
         image.texture = player.targetTexture;
         player.Play();
         return clip;
     }
     if (isInside)
     {
         VideoClip clip = LoadVideo(video);
         player.source = VideoSource.VideoClip;
         player.clip = clip;
         image.texture = player.targetTexture;
         player.Play();
         return clip;
     }
     else
     {
         player.source = VideoSource.Url;
         player.url = video;
         image.texture = player.targetTexture;
         player.Play();
         return null;
     }
 }
    //Plays a video
    public void PlayVideo(string videoName)
    {
        VideoClip clip = Resources.Load <VideoClip>(videoName) as VideoClip;

        vp_VideoPlayerRef.clip = clip;
        vp_VideoPlayerRef.Play();
    }
    private void AssignEpisodesToScreenAndShuffle()
    {
        while (unassignedAssets.Count > 0)
        {
            int episodeIdx = UnityEngine.Random.Range(0, unassignedAssets.Count);
            GazeInteractionController curScreen = screens[unassignedAssets.Count % screens.Count];
            Debug.Log("Episode [" + episodeIdx.ToString() + "] goes to Screen [" + (unassignedAssets.Count % screens.Count).ToString() + "].");
            VideoClip videoClip = unassignedAssets[episodeIdx].Item2;
            curScreen.AddVideoClip(videoClip);
            if (!curScreen.IsImageSet())
            {
                Texture image = unassignedAssets[episodeIdx].Item1;
                curScreen.SetImage(image);
            }
            unassignedAssets.RemoveAt(episodeIdx);
        }

        while (screens.Count > 0)
        {
            int randomIdx = UnityEngine.Random.Range(0, screens.Count);
            GazeInteractionController screen = screens[randomIdx];
            screenQueue.Enqueue(screen);
            screens.RemoveAt(randomIdx);
        }
    }
        public static VideoClip GetVideoClip(int id)
        {
            MySqlCommand cmd = new MySqlCommand("spGetVideoClip", db.Connection);

            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@clipid", id);
                cmd.Connection.Open();
                MySqlDataReader dr   = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                VideoClip       clip = null;
                dr.Read();
                if (dr.HasRows)
                {
                    clip = PopulateClip(dr);
                }

                dr.Close();
                db.Connection.Dispose();
                return(clip);
            }
            finally
            {
                cmd.Connection.Close();
                db.Connection.Dispose();
            }
        }
Ejemplo n.º 5
0
    public bool GetVideo(int pre_exit_, out VideoClip clip_, out int cur_exit_, bool is_first = false)
    {
        clip_     = null;
        cur_exit_ = 0;

        int cur_entrance;

        if (!is_first)
        {
            cur_entrance = this.GetEnterDoor(pre_exit_);
        }
        else
        {
            cur_entrance = this.GetEnterDoor(C_DEFAULT_ENTER_DOOR);
        }

        if (!m_entrance_2_video_dict.ContainsKey(cur_entrance))
        {
            return(false);
        }

        clip_     = m_entrance_2_video_dict[cur_entrance].m_video;
        cur_exit_ = GetExitDoor(m_entrance_2_video_dict[cur_entrance].m_exit);

        return(true);
    }
Ejemplo n.º 6
0
    public void PlayVideo(VideoClip clip)
    {
        lastClip              = clip;
        videoAudio.loop       = false;
        videoPlayer.isLooping = false;

        StopAllCoroutines();

        if (!isTapeSet)
        {
            videoPlayer.clip = clip;
            lastFrame        = 0;
            hasInput         = true;
            hasTape          = true;
            isRender         = true;
            isStarted        = true;
            isTapeSet        = true;
        }

        videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
        videoPlayer.SetTargetAudioSource(0, videoAudio);
        videoPlayer.EnableAudioTrack(0, true);
        videoPlayer.controlledAudioTrackCount = 1;
        videoPlayer.targetTexture             = renderTexture;

        if (isOn)
        {
            Display.material = RenderMaterial;
            Display.material.SetTexture("_MainTex", renderTexture);
        }

        StartCoroutine(PrepareAndPlay(lastFrame));
    }
Ejemplo n.º 7
0
    void HelpVideoChange()
    {
        //今選択中のカーソルが
        switch (getCursol)
        {
        //CycleSatelliteを表示する
        case 0:
            videoClip        = Resources.Load <VideoClip>("HelpVideo_C");
            videoPlayer      = GameObject.Find("HelpVideo").GetComponent <VideoPlayer>();
            videoPlayer.clip = videoClip;
            break;

        //MakeMobiusを表示する
        case 1:
            videoClip        = Resources.Load <VideoClip>("HelpVideo_A");
            videoPlayer      = GameObject.Find("HelpVideo").GetComponent <VideoPlayer>();
            videoPlayer.clip = videoClip;
            break;

        //DeepWatcherを表示する
        case 2:
            videoClip        = Resources.Load <VideoClip>("HelpVideo_B");
            videoPlayer      = GameObject.Find("HelpVideo").GetComponent <VideoPlayer>();
            videoPlayer.clip = videoClip;
            break;
        }
    }
Ejemplo n.º 8
0
    public void PauseVideoAT(long frame, VideoClip clip, bool on)
    {
        videoPlayer.clip = clip;
        lastClip         = clip;

        videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
        videoPlayer.SetTargetAudioSource(0, videoAudio);
        videoPlayer.EnableAudioTrack(0, true);
        videoPlayer.controlledAudioTrackCount = 1;
        videoPlayer.targetTexture             = renderTexture;
        videoPlayer.frame = frame;
        lastFrame         = frame;

        hasInput  = true;
        hasTape   = true;
        isRender  = false;
        isStarted = true;

        if (on)
        {
            isOn = true;
            SetOsdScreen(OSD.Pause);
            EnableScreen(true);
        }
    }
    public void Nex()
    {
        /*
         * if(Media[mediaX].clip != null && Media[mediaX].pic != null)
         * {
         *  mediaX = 0;
         * }
         */

        if (loadedClip != null)
        {
            Resources.UnloadAsset(loadedClip);
            Vplayer.GetComponent <VideoPlayer>().clip = null;
            loadedClip = null;
        }


        if (mediaX == Media.Length - 1)
        {
            mediaX = 0;
        }
        else
        {
            mediaX++;
        }

        setup = false;
    }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;

        if (string.IsNullOrEmpty(sceneAfterPlayback))
        {
            sceneAfterPlayback = VideoLoader.sceneAfterPlayback;
        }

        videoPlayer = GetComponent <VideoPlayer>();
        videoPlayer.loopPointReached += EndReached;

        subtitles = GameObject.FindGameObjectWithTag("Subtitles");
        subtitlesTextGameObject = subtitles.GetComponent <UnityEngine.UI.Text>();

        if (subtitlesTextGameObject != null)  // If there is a subtitles text game object
        {
            subtitlesTextGameObject.text = string.Empty;
        }

        VideoClip presetClip = gameObject.GetComponent <VideoPlayer>().clip;

        if (presetClip != null)
        {
            StartVideoPlayback(presetClip);
        }
        else if (VideoLoader.currentVideo != null)
        {
            StartVideoPlayback(VideoLoader.currentVideo);
        }
    }
Ejemplo n.º 11
0
 public void PlayInteractiveVideo(VideoClip video)//Jouer une video
 {
     DisableInteractiveVideoButton();
     my_video_player.clip = video;
     my_video_player.Play();
     my_video_player.loopPointReached += UpdateButtonVideo;
 }
Ejemplo n.º 12
0
    void SetVideo(MediumData medium, VideoClip video)
    {
        VideoPlayer vp = medium.slate.GetComponent <VideoPlayer>();

        vp.enabled = true;
        vp.clip    = video;
    }
Ejemplo n.º 13
0
    IEnumerator PlayErrorVideo(VideoClip clip, int side)
    {
        PlayErrorSound();
        videoPlayer.renderMode = VideoRenderMode.MaterialOverride;
        videoPlayer.source     = VideoSource.VideoClip;
        videoPlayer.clip       = clip;


        WaitForSeconds waitForSeconds = new WaitForSeconds(0.5F);

        while (!videoPlayer.isPrepared)
        {
            yield return(waitForSeconds);

            break;
        }

        if (side == 0)
        {
            leftCube.SetActive(true);
            videoPlayer.targetMaterialRenderer = leftCube.GetComponent <MeshRenderer>();
        }
        else if (side == 1)
        {
            rightCube.SetActive(true);
            videoPlayer.targetMaterialRenderer = rightCube.GetComponent <MeshRenderer>();
        }
        videoPlayer.Prepare();
        videoPlayer.Play();
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Play a video clip using the current settings
    /// </summary>
    /// <param name="clip">The video clip to play (if null, then current clip will play)</param>
    public GmDelayPromise PlayClip(VideoClip clip = null, string heading = null)
    {
        // Heading
        if (headingText != null)
        {
            headingText.SetText(heading ?? "");
        }

        videoMaterial.SetColor("_Color", FadeInFrom);
        GameManager.Instance.ShowCamera(videoCamera);

        this.playPromise = new GmDelayPromise();

        // If no clip - play the one already set
        if (clip != null)
        {
            videoPlayer.clip = clip;
        }

        //Debug.Log("Prepare");
        videoPlayer.Prepare();
        isPlaying = true;

        fadingIn       = false;
        fadingOutAudio = false;
        fadingOutVideo = false;

        return(playPromise);
    }
Ejemplo n.º 15
0
    private IEnumerator CoPlayMovieFromVideoClip(VideoClip clip, Action onEnded)
    {
        onEndMovie = onEnded;

        videoPlayer.source = VideoSource.VideoClip;
        videoPlayer.url    = null;

        //Set Audio Output to AudioSource
        videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;

        //Assign the Audio from Video to AudioSource to be played
        videoPlayer.EnableAudioTrack(0, true);
        videoPlayer.SetTargetAudioSource(0, audioSource);

        //Set video To Play then prepare Audio to prevent Buffering
        videoPlayer.clip = videoClipToPlay;
        videoPlayer.Prepare();

        //Wait until video is prepared
        WaitForSeconds waitTime = new WaitForSeconds(1);

        while (!videoPlayer.isPrepared)
        {
            //Prepare/Wait for 5 sceonds only
            yield return(waitTime);

            //Break out of the while loop after 5 seconds wait
            break;
        }
        Debug.Log("Done Preparing Video");

        videoPlayer.controlledAudioTrackCount = videoPlayer.audioTrackCount;

        //Play Video
        videoPlayer.Play();

        //Play Sound
        audioSource.Play();

        while (videoPlayer.texture == null)
        {
            yield return(null);
        }
        Debug.Log("Done Prepared display texture");

        //Assign the Texture from Video to RawImage to be displayed
        targetImage.texture = videoPlayer.texture;

        Debug.Log("Playing Video");

        while (videoPlayer.isPlaying)
        {
            yield return(null);
        }

        Debug.Log("Done Playing Video");

        VideoPlayer_endMovie();
    }
    public override void OnInspectorGUI()
    {
        VideoScriptPlayableAsset videoAsset = (VideoScriptPlayableAsset)target;
        GUIStyle lStyle = GetLabelStyle();

        GUILayout.Label("UI RawImage to play the video on:", lStyle);
        EditorGUILayout.PropertyField(rawImage);
        GUILayout.Space(10);

        VideoClip tempClip = videoAsset.videoClip;

        GUILayout.Label("Assign a Video Clip to Play:", lStyle);
        tempClip = (VideoClip)EditorGUILayout.ObjectField(tempClip, typeof(VideoClip), false);
        if (tempClip != videoAsset.videoClip && tempClip != null)
        {
            EditorUtility.DisplayDialog("New Clip Assigned", "Remember to make sure your video clip has 'Transcode' enabled in the Import Settings.", "Close");
        }
        videoAsset.videoClip = tempClip;
        videoAsset.loop      = EditorGUILayout.Toggle("Loop Video?", videoAsset.loop);
        GUILayout.Space(10);

        videoAsset.mute = EditorGUILayout.Toggle("Mute the video?", videoAsset.mute);
        if (!videoAsset.mute)
        {
            bool useDirectAudio = videoAsset.audioOutputMode == VideoAudioOutputMode.Direct;
            useDirectAudio = EditorGUILayout.Toggle("Use Direct Audio", useDirectAudio);
            if (useDirectAudio)
            {
                videoAsset.audioOutputMode = VideoAudioOutputMode.Direct;
            }
            else
            {
                EditorGUILayout.PropertyField(audioSource, new GUIContent("Audio Source"));
                if (PropertyName.IsNullOrEmpty(videoAsset.audioSource.exposedName))
                {
                    videoAsset.audioOutputMode = VideoAudioOutputMode.None;
                }
                else
                {
                    videoAsset.audioOutputMode = VideoAudioOutputMode.AudioSource;
                }
            }
        }
        else
        {
            videoAsset.audioOutputMode = VideoAudioOutputMode.None;
        }
        GUILayout.Space(10);

        GUILayout.Label("Use these to clip seconds from the start and end of the video which you don't want to play:", lStyle);
        videoAsset.startTime = EditorGUILayout.DoubleField("Start Time", videoAsset.startTime);
        videoAsset.endTime   = EditorGUILayout.DoubleField("End Time", videoAsset.endTime);
        GUILayout.Space(10);

        GUILayout.Label("Increase if you experience performance issues:", lStyle);
        videoAsset.preloadTime = EditorGUILayout.DoubleField("Preload Time", videoAsset.preloadTime);

        serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 17
0
    void DrawGrid()
    {
        GameObject newObj;

        // 1. Load textures from image files
        textures = Resources.LoadAll("Images", typeof(Texture2D));

        for (int i = 0; i < textures.Length; i++)
        {
            newObj = (GameObject)Instantiate(capturedButtonImagePrefab, transform);

            // Apply images to GameObject

            // Create sprite
            myTexture = (Texture2D)textures[i];
            sprite    = Sprite.Create(myTexture, new Rect(0, 0, myTexture.width, myTexture.height), new Vector2(0.5f, 0.5f));
            newObj.GetComponent <Image>().sprite = sprite;
        }

        // Initiate toggle button
        toggles = GameObject.FindGameObjectsWithTag("ToggleForSelection");
        UIGameObjectHandler.setActiveStatus(toggles, false);

        // 2. Load textures from video files
        VideoClip video = Resources.Load("Videos/gatos_", typeof(VideoClip)) as VideoClip;

        GameObject videoPlayerGameObject = (GameObject)Instantiate(videoPlayerPrefab, transform);

        VideoPlayer videoPlayer = videoPlayerGameObject.GetComponent <VideoPlayer>();

        //videoPlayer.time = 0;
        //videoPlayer.Play();
        //int width = videoPlayer.texture.width;
        //int height = videoPlayer.texture.height;
        //Texture2D preview = new Texture2D(width, height, TextureFormat.RGB24, false);
        //RenderTexture.active = videoPlayer.targetTexture;
        //preview.ReadPixels(new Rect(0, 0, width, height), 0, 0);
        //preview.Apply();
        //sprite = Sprite.Create(preview, new Rect(0, 0, width, height), new Vector2(0.5f, 0.5f));
        //videoPlayer.Pause();
        //RenderTexture.active = null;

        //newObj = (GameObject)Instantiate(capturedButtonImagePrefab, transform);

        // Create sprite
        //newObj.GetComponent<Image>().sprite = sprite;

        //for (int i = 0; i < videos.Length; i++)
        //{
        //    newObj = (GameObject)Instantiate(capturedButtonImagePrefab, transform);

        //    // Apply images to GameObject

        //    // Create sprite
        //    myTexture = (Texture2D)videoPlayer.texture;
        //    sprite = Sprite.Create(myTexture, new Rect(0, 0, myTexture.width, myTexture.height), new Vector2(0.5f, 0.5f));
        //    newObj.GetComponent<Image>().sprite = sprite;
        //}
    }
Ejemplo n.º 18
0
 public void Load(VideoClip clip)
 {
     videoPlayer.clip = clip;
     if (audioSource != null)
     {
         videoPlayer.SetTargetAudioSource(0, audioSource);
     }
 }
Ejemplo n.º 19
0
    VideoClip GetTheVideoClip(string s)
    {
        string path = "Video/" + s;

        videoClip = Resources.Load <VideoClip>(path);

        return(videoClip);
    }
Ejemplo n.º 20
0
        public void PlayVideo(VideoClip videoToPlay)
        {
            Application.runInBackground = true;

            DeactivateSceneElements();
            StartCoroutine(PlayIntro(videoToPlay));
            //StartCoroutine(HideSkipTextAfterSecs());
        }
Ejemplo n.º 21
0
        public static Dictionary <string, object> ToGDEDict(this VideoClip variable, string fieldName)
        {
            var result = new Dictionary <string, object> ();

            result.Add(fieldName.GDETypeKey(), BasicFieldType.VideoClip.ToString());
            result.Add(fieldName, variable.ToDictValue());
            return(result);
        }
Ejemplo n.º 22
0
    void PlayRandomVideo()
    {
        int index = Random.Range(0, allVideos.Length);

        randomClip    = allVideos[index];
        myPlayer.clip = randomClip;
        myPlayer.Play();
    }
Ejemplo n.º 23
0
 public void PlayVideoOnLoop(VideoClip video)
 {
     player.Stop();
     player.clip              = video;
     player.isLooping         = true;
     player.waitForFirstFrame = true;
     player.Play();
 }
Ejemplo n.º 24
0
    public FapData(string fileName, FileCategory category, VideoClip clip) : base(fileName, category)
    {
        Extension = FileExtensions.FAP;

        Clip = clip;

        Size = FileSizeCalculator.GetRandFileSize(Extension);
    }
Ejemplo n.º 25
0
    public void Play(VideoClip clip, Action clipOverAction = null)
    {
        _videoPlayer.isLooping = false;
        _videoPlayer.clip      = clip;
        _videoPlayer.Play();

        m_clipOverAction = clipOverAction;
    }
Ejemplo n.º 26
0
    private bool _isPlaying        = false;//用于处理主动停止播放

    private void Awake()
    {
        if (m_videoPlayer == null)
        {
            m_videoPlayer = this.GetComponent <VideoPlayer>();
        }
        m_videoClip = m_videoPlayer.clip;
    }
Ejemplo n.º 27
0
 public void PlayVideo(VideoClip video, UnityAction videoEndCallback = null)
 {
     firstClickTime    = 0;
     onVideoEnd        = videoEndCallback;
     videoPlayer.clip  = video;
     videoPlayer.frame = 0;
     videoPlayer.Play();
 }
Ejemplo n.º 28
0
 void Start()
 {
     Application.runInBackground = true;
     videoToPlay = (VideoClip)Resources.Load("Videos/tutorial_1");
     tutorialPt2 = (VideoClip)Resources.Load("Videos/tutorial_2");
     tutorialPt3 = (VideoClip)Resources.Load("Videos/tutorial_3");
     StartCoroutine(PlayVideo());
 }
Ejemplo n.º 29
0
        public void SetUp()
        {
            EditorSceneManager.OpenScene(GetTestAssetPath("EmptyTestScene.unity"));

            m_VideoPlaybackManager = new VideoPlaybackManager();
            m_VideoClip1           = AssetDatabase.LoadAssetAtPath <VideoClip>(GetTestAssetPath("TestVideoClip1.mov"));
            m_VideoClip2           = AssetDatabase.LoadAssetAtPath <VideoClip>(GetTestAssetPath("TestVideoClip2.mov"));
        }
Ejemplo n.º 30
0
    public void SetSkybox(VideoClip vid)
    {
        video = vid;

        Invoke("fadeToBlack", 0);
        Invoke("switchToVid", fadeTime / 3);
        Invoke("fadeBack", 2 * fadeTime / 3);
    }
Ejemplo n.º 31
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _id = Request["ID"];
            string _gh_id = Request["GH_ID"];
            string _chude_id = Request["ChuDe_ID"];
            string _chude_ten = Request["TenChuDe"];
            string _ten = Request["Ten"];
            string _thutu = Request["Thutu"];
            string _mota = Request["Mota"];
            string _anh = Request["UrlImage"];
            string _duyet = Request["Duyet"];
            string _clip = Request["Url"];
            string _cq_id = Request["CQ_ID"];
            string _active = Request["Active"];
            string _q = Request["q"];

            #endregion
            switch (subAct)
            {
                case "getVideo":
                    #region lấy danh sách

                    string _NguoiTao = Security.Username;
                    if (string.IsNullOrEmpty(jgRows)) jgRows = "5";
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "Thutu";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc";
                    Pager<VideoClip> PagerGet = VideoClipDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, Request["rows"], _gh_id, _chude_id, _active);
                    List<jgridRow> ListRow = new List<jgridRow>();
                    foreach (VideoClip item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[]{
                            item.ID.ToString()
                             ,string.Format(item.Thutu.ToString()==null?"":item.Thutu.ToString())
                            ,string.Format("<img class=\"adm-pro-icon\" src=\"../up/v/{0}\" />", string.IsNullOrEmpty(item.UrlImage) ? "no-image.png" :item.UrlImage)
                            ,string.Format(item.Ten.ToString()==null?"":item.Ten.ToString())
                            ,string.Format(item.Mota.ToString()==null?"":item.Mota.ToString())
                            ,string.Format(item.SoLuotXem.ToString()==null?"":item.SoLuotXem.ToString())
                            ,DanhMucDal.SelectById(item.ChuDe_ID).Ten.ToString()
                            ,item.Ngaytao.ToString("dd/MM/yy")
                            ,item.NguoiTao
                            ,item.Active.ToString()

                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "saveVideo":
                    #region lưu dữ liệu
                    VideoClip ItemSave = new VideoClip();
                    if (!string.IsNullOrEmpty(_id))
                    {
                        ItemSave = VideoClipDal.SelectById(Convert.ToInt32(_id));
                    }

                    ItemSave.Ten = _ten;
                    ItemSave.ChuDe_ID = int.Parse(_chude_id);
                    ItemSave.Mota = string.IsNullOrEmpty(_mota) ? "" : _mota;
                    ItemSave.Active = Convert.ToBoolean(_duyet);
                    ItemSave.UrlImage = _anh;
                    ItemSave.Url = _clip;
                    ItemSave.Thutu = Convert.ToInt16(_thutu);
                    ItemSave.Loai = 1;
                    ItemSave.Keyword = "";
                    ItemSave.CateID = 0;

                    // ItemSave.PID = Convert.ToInt32(_PID);

                    if (!string.IsNullOrEmpty(_id))
                    {
                        ItemSave.NguoiTao = Security.Username;
                        ItemSave.Ngaytao = DateTime.Now;
                        ItemSave = VideoClipDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave.SoLuotXem = 0;
                        ItemSave.NguoiTao = Security.Username;
                        ItemSave.Ngaytao = DateTime.Now;
                        ItemSave.RowId = Guid.NewGuid();
                        ItemSave = VideoClipDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "delVideo":
                    #region xóa
                    if (!string.IsNullOrEmpty(_id))
                    {
                        char[] step = { ',' };
                        string[] arrID = _id.Split(step);
                        for (int i = 0; i < arrID.Length; i++)
                        {
                            VideoClip o = new VideoClip();
                            o = VideoClipDal.SelectById(Convert.ToInt32(arrID[i]));
                            try
                            {
                                System.IO.File.Delete(Server.MapPath("~/up/v/" + o.UrlImage));
                                System.IO.File.Delete(Server.MapPath("~/up/v/" + o.Url));
                            }
                            catch { }
                            VideoClipDal.DeleteById(Convert.ToInt32(arrID[i]));
                        }
                    }
                    break;
                    #endregion
                case "duyetVideo":
                    #region Duyệt
                    if (!string.IsNullOrEmpty(_id))
                    {
                        char[] step = { ',' };
                        string[] arrID = _id.Split(step);
                        for (int i = 0; i < arrID.Length; i++)
                        {
                            VideoClip o = new VideoClip();
                            o = VideoClipDal.SelectById(Convert.ToInt32(arrID[i]));
                            o.Active = true;
                            VideoClipDal.Update(o);
                        }
                    }
                    break;
                    #endregion
                case "dungVideo":
                    #region Dừng
                    if (!string.IsNullOrEmpty(_id))
                    {
                        char[] step = { ',' };
                        string[] arrID = _id.Split(step);
                        for (int i = 0; i < arrID.Length; i++)
                        {
                            if (arrID[i] != "")
                            {
                                VideoClip o = new VideoClip();
                                o = VideoClipDal.SelectById(Convert.ToInt32(arrID[i]));
                                o.Active = false;
                                VideoClipDal.Update(o);
                            }
                        }
                    }
                    break;
                    #endregion
                case "editVideo":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_id))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(VideoClipDal.SelectById(Convert.ToInt32(_id))) + ")");
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.videoClip.qlVideoClip.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(@"<div class=""mdl-head"">
             <a class=""mdl-head-btn mdl-head-add"" id=""videoMdl-addBtn"" href=""javascript:qlvideoClipfn.addVideo(); "">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""videoMdl-editBtn"" href=""javascript:qlvideoClipfn.editVideo();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""videoMdl-delBtn"" href=""javascript:qlvideoClipfn.delVideo();"">Xóa</a>
            <a class=""mdl-head-btn mdl-head-active"" id=""videoMdl-actBtn"" href=""javascript:qlvideoClipfn.duyetVideo();"">Duyệt</a>
            <a class=""mdl-head-btn mdl-head-deactive"" id=""videoMdl-edactBtn"" href=""javascript:qlvideoClipfn.dungVideo();"">Dừng</a>
            </div>

            <div id=""VideoClip-qlVC-head"" class=""mdl-head mdl-headTask ui-accordion-header ui-helper-reset ui-state-default ui-widget ui-corner-all"">
            <span>
                <input type=""text"" _value="""" class=""admtxt-da ui-corner-all mdl-head-qlVC-filterChuDe"" /><button class=""admfilter-btn"" tabindex=""-1""></button>
            </span>
            <span>
                <input type=""text"" class=""admtxt-da ui-corner-all mdl-head-search-qlVC-VideoClipmdl"" /><button class=""admSearch-btn"" tabindex=""-1""></button>
            </span>
              </div>
            </div>

            <table id=""videoClipMdl-qlVideoClip-List"" class=""mdl-list""></table>
            <div id=""videoClipmdl-qlVideoClip-Pager""></div>");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                       , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.videoClip.qlVideoClip.JScript1.js")
                       , "{qlvideoClipfn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
 public VideoPlayer(VideoClip videoClip)
     : base(videoClip)
 {
 }
 public virtual void Play(VideoClip videoClip)
 {
     CanPlay();
 }
 protected Player(VideoClip videoClip)
 {
     _videoClip = videoClip;
 }
 public override void Play(VideoClip videoClip)
 {
     Console.WriteLine("Play videoclip");
     base.Play(videoClip);
 }