public virtual void Start () {
		 videoManagerScript = Camera.main.GetComponent<VideoManager>();
		 if(!videoManagerScript){
		 	videoManagerScript = Camera.main.gameObject.AddComponent<VideoManager>();
			Debug.LogError("Balls! you don't have a video manager script anywhere.");
		 }

		PlaneScaler planeScaler = GetComponent<PlaneScaler>();
		Backdrop backdrop = GetComponent<Backdrop>();
		if(!planeScaler && !backdrop)
			gameObject.AddComponent<PlaneScaler>();

		videoManagerScript.addInstance(this);
		//setup the texture type : RenderTexture vs. Texture2D
		updateTextureType();
		
		//create the videoTextureCache ptr, for when you update things on the GL thread
		videoTextureInstance = createVideoTexture();
			
		if(videoTextureInstance == (IntPtr)0){
			Debug.LogError("You didn't have a VideoManager initialized before "  +
			"creating this video instance on " + gameObject.name +  ". Please create one and try again.");
		}	
		beginPlayback();
		
		//required for script-based initialization
		hasStarted = true;
	}
	// Use this for initialization
	void Start () {
		videoManagerScript = Camera.main.GetComponent<VideoManager>();
		if(!videoManagerScript){
			videoManagerScript = Camera.main.gameObject.AddComponent<VideoManager>();
			Debug.LogError("Balls! you don't have a video manager script on your camera yet, so I've added one now for you!");
		}

	}
        public void InitVideoInfo()
        {
            videoManager = VideoManager.GetInstance();
            FilterVideo();

            this.classTypeComboBox.Items.Add("所有");
            foreach (var item in ClassTypeManager.GetInstance().GetClassType())
            {
                this.classTypeComboBox.Items.Add(item);
            }
        }
Esempio n. 4
0
 public static VideoManager GetInstance()
 {
     if (instance == null)
     {
         //instance = new VideoManager();
         GameObject go = new GameObject("[VideoManager]",
                                        typeof(VideoManager)
                                        //typeof(VideoPlayCompont),
                                        // typeof(MediaPlayer)
                                        );
         instance = go.GetComponent <VideoManager>();
         GameObject.DontDestroyOnLoad(go);
     }
     return(instance);
 }
Esempio n. 5
0
 void OnSelect()
 {
     if (!recording)
     {
         video = new VideoManager();
         video.TakeVideo(AssetManager.Instance);
         recording = true;
     }
     else
     {
         video.StopRecordingVideo();
         recording = false;
         Destroy(video);
     }
 }
        public async Task <IActionResult> Video(int id)
        {
            var          client  = _httpClientFactory.CreateClient();
            VideoManager manager = new VideoManager(client);

            VideoModel video = await manager.GetSelectedVideo(id);

            List <CommentModel> commentList = await manager.GetSelectedVideoComments(id);

            List <CommentModel> updatedCommentList = await manager.AddUserToComments(commentList);

            SelectedVideoModel selectedVideo = new SelectedVideoModel(video, updatedCommentList);

            return(View(selectedVideo));
        }
Esempio n. 7
0
 public override void OnEnter()
 {
     videoMan = VideoManager.GetInstance();
     time     = videoMan.VideoComp.GetCurrentTimeMs();
     if (MediaComeToStop.stopBlock)
     {
         update = false;
         Continue();
     }
     else
     {
         update     = true;
         StartBlock = true;
     }
 }
Esempio n. 8
0
    public void ButtonClicked(string str)
    {
        scrollView.SetActive(false);
        closeButton.SetActive(false);
        wordListExplanation.SetActive(false);
        search.SetActive(false);

        practice.SetActive(true);
        selectedWord.SetActive(true);
        backButton.SetActive(true);
        videoGroup.SetActive(true);

        sharedVideoManager = VideoManager.getVideoManager();
        sharedVideoManager.ChangeReviewVideo(str);
        currentWord = str;
    }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        gameObject.AddComponent <LineRenderer>();
        phaser = GetComponent <LineRenderer>();

        phaser.material   = phaserMaterial;
        phaser.startWidth = 0.1f;
        phaser.endWidth   = 0.1f;

        fireWeapons = FireWeapons();
        StartCoroutine(fireWeapons);

        audioSource = GetComponent <AudioSource>();

        videoManager = GameObject.Find("VideoManager").GetComponent <VideoManager>();
    }
Esempio n. 10
0
 private void PpalMedicos_Load(object sender, EventArgs e)
 {
     try
     {
         vManager = new VideoManager();
         vManager.BuscarDispositivos();
         vManager.pbxCamera        = pbxCamera;
         btnTake.Text              = vManager.cameraStatus;
         cmbDispositivo.DataSource = vManager.lstDispositivos;
         lblUsuario.Text           = activeUser.name;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 11
0
    private VideoPlayCompont _videoComp;//播放视频组件

    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Object.DestroyImmediate(this);
            return;
        }
        instance = this;
        var mp = GetComponent <MediaPlayer>();

        if (mp != null)
        {
            mp.m_AutoOpen  = false;
            mp.m_AutoStart = false;
        }
    }
Esempio n. 12
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Debug.LogWarning("You have 2 VideoManagers! This one will be destroyed");
            Destroy(this.gameObject);
        }

        audioSource = GetComponent <AudioSource>();
        vPlayer     = GetComponent <VideoPlayer>();

        vPlayer.prepareCompleted += PrepareCompleted;
    }
Esempio n. 13
0
    private void Awake()
    {
        if (videomanagerST != null)
        {
            Destroy(this);
        }
        if (videomanagerST == null)
        {
            videomanagerST = this;
        }

        player    = GameObject.FindGameObjectWithTag("Player");
        videoList = PlayerPrefs._playerPref.videoList;


        TimeManager.DayCounterEvent += RefreshVideo;
    }
Esempio n. 14
0
        private void BindPlayVideo()
        {
            int       vid = Convert.ToInt32(ViewState["vid"]);
            DataTable dt  = VideoManager.selectKey(vid);

            if (dt != null && dt.Rows.Count == 1)
            {
                txtTitle.Text      = dt.Rows[0][1].ToString();
                txtCreateTime.Text = string.Format("{0:yyyy-MM-dd hh:mm}", dt.Rows[0][2]);

                VDHF.Value = dt.Rows[0][3].ToString().Replace("~", "..");

                videoDLImgBtn.CommandArgument = dt.Rows[0][3].ToString();
                txtClickNum.Text    = (Convert.ToInt32(dt.Rows[0][4]) + BLL.VideoManager.updateClickNum(vid)).ToString();
                txtDownLoadNum.Text = dt.Rows[0][5].ToString();
            }
        }
Esempio n. 15
0
    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(Instance.gameObject);
        }

        Instance = this;

        TryGetComponent(out videoPlayer);

        TryGetComponent(out camera);

        camera.enabled = false;
        videoPanel.gameObject.SetActive(false);
        videoPlayer.loopPointReached += OnVideoEnded;
    }
Esempio n. 16
0
        // Use this for initialization
        void Start()
        {
            _itemsController  = GameObject.Find("Player").GetComponent <ItemsController>();
            _videoManager     = GameObject.Find("VideoPlayer").GetComponent <VideoManager>();
            _playerController = GameObject.Find("Player").GetComponent <PlayerController>();
            _promptText       = GameObject.Find("Interact text");
            _fadeOut          = GameObject.Find("FadeOut");

            if (SharedInfo.InitialScenePlayed)
            {
                _promptText.SetActive(false);
            }
            else
            {
                _fadeOut.SetActive(false);
            }
        }
Esempio n. 17
0
    void OnSelect()
    {
        switch (videoRecordingState)
        {
            case 0:

                Debug.Log("Clicked once" + gameObject.name);
                foreach (MeshRenderer m in mr)
                {
                    m.enabled = false;
                }


                GameObject videoCaptureMessageObject;
                videoCaptureMessageObject = (GameObject)Instantiate(videoCaptureMessage, new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z + 2f), Quaternion.identity);
                videoCaptureMessageObject.AddComponent<Billboard>();
                Destroy(videoCaptureMessageObject, 2f);

                GestureManager.Instance.OverrideFocusedObject = gameObject;
                videoRecordingState = 1;

                break;
            case 1:
                Debug.Log("Clicked twice" + gameObject.name);
                video = new VideoManager();
                video.TakeVideo();
                videoRecordingState = 2;
                break;
            case 2:
                Debug.Log("Clicked thrice" +gameObject.name);

                video.StopRecordingVideo();
                Destroy(video);
                videoRecordingState = 0;

                foreach (MeshRenderer m in mr)
                {
                    m.enabled = true;
                }
                GestureManager.Instance.OverrideFocusedObject = null;
                break;

        }

    }
Esempio n. 18
0
    private void Update()
    {
        if (inMainMenu)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (mainMenuCursor == 0) // start game
                {
                    FindObjectOfType <AudioManager>().StopPlaying("MenuSong");
                    VideoManager videoManager = FindObjectOfType <VideoManager>();
                    //Play Cutscene
                    videoManager.PrepareVideo();
                }
                else // quit
                {
                    //GameObject.Find("Video Player").GetComponent<VideoManager>().PrepareVideo();
                    Application.Quit();
                }
            }
            if (Input.GetKeyDown(KeyCode.W) && mainMenuCursor == 1)
            {
                FindObjectOfType <AudioManager>().Play("Click");
                GameObject.Find("StartGame").GetComponent <Text>().text = "> Start Game";
                GameObject.Find("Quit").GetComponent <Text>().text      = "  Quit";
                mainMenuCursor = 0;
            }
            if (Input.GetKeyDown(KeyCode.S) && mainMenuCursor == 0)
            {
                FindObjectOfType <AudioManager>().Play("Click");
                GameObject.Find("StartGame").GetComponent <Text>().text = "  Start Game";
                GameObject.Find("Quit").GetComponent <Text>().text      = "> Quit";
                mainMenuCursor = 1;
            }
        }
        else if (SceneManager.GetActiveScene().name == "GameOver" && Input.GetKeyDown(KeyCode.Space))
        {
            Player.GetInstance().Battle(Player.GetInstance().GetCurrentEnemy());
        }

        if (activeScene != SceneManager.GetActiveScene())
        {
            activeScene = SceneManager.GetActiveScene();
            PrepareScene();
        }
    }
Esempio n. 19
0
 public async Task <IActionResult> UploadVideo(string videoEncodingFormats = null, bool?sprite = null)
 {
     try
     {
         return(Ok(new
         {
             success = true, token = VideoManager.ComputeVideo(await GetFileToTemp(), videoEncodingFormats, sprite)
         }));
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception Upload Video : {0}", ex);
         return(BadRequest(new
         {
             errorMessage = ex.Message
         }));
     }
 }
Esempio n. 20
0
 public async Task <IActionResult> UploadVideo(string videoEncodingFormats = null, bool?sprite = null)
 {
     try
     {
         return(Ok(new
         {
             success = true, token = VideoManager.ComputeVideo(await GetFileToTemp(), videoEncodingFormats, sprite)
         }));
     }
     catch (Exception ex)
     {
         LogManager.AddEncodingMessage(LogLevel.Critical, "Exception non gérée", "Exception", ex);
         return(BadRequest(new
         {
             errorMessage = ex.Message
         }));
     }
 }
Esempio n. 21
0
 public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
 {
     // Define conditional logic for each ad completion status:
     if (showResult == ShowResult.Finished)
     {
         VideoManager videoManager = FindObjectOfType <VideoManager>();
         videoManager.GetCurrentButton(gameObject);
         videoManager.ShowVideoFromURL("https://gamehostarikaton.000webhostapp.com/video_bear/5.mp4");
     }
     else if (showResult == ShowResult.Skipped)
     {
         print("Ads skipped");
     }
     else if (showResult == ShowResult.Failed)
     {
         Debug.LogWarning("The ad did not finish due to an error.");
     }
 }
Esempio n. 22
0
    // Use this for initialization
    void Start()
    {
        keywords.Add("Next", () =>
        {
            InstructionManager.NextStep();
        });

        keywords.Add("Back", () =>
        {
            InstructionManager.PreviousStep();
        });

        keywords.Add("Help", () =>
        {
            InspectionManager.Help();
        });

        keywords.Add("Close", () =>
        {
            InspectionManager.Close();
        });

        keywords.Add("Play", () =>
        {
            VideoManager.Play();
        });

        keywords.Add("Pause", () =>
        {
            VideoManager.Pause();
        });

        keywords.Add("Stop", () =>
        {
            VideoManager.Stop();
        });

        // Tell the KeywordRecognizer about our keywords.
        keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());

        // Register a callback for the KeywordRecognizer and start recognizing!
        keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
        keywordRecognizer.Start();
    }
    public static void startCustomizedLevel()
    {
        if (Instance == null || !Instance.tryingToCustomize)
        {
            return;
        }
        int numOfWords = Instance.selectedWord.Count;

        if (numOfWords < 3 || numOfWords > 5)
        {
            return;
        }

        Debug.Log(numOfWords);

        LinkedList <TextAsset> listOfLevelsToPick = Instance.levels[numOfWords];

        if (listOfLevelsToPick == null || listOfLevelsToPick.Count < 1)
        {
            return;
        }

        System.Random randomPicker     = new System.Random();
        int           randomUpperBound = listOfLevelsToPick.Count;
        int           randomIndex      = randomPicker.Next(randomUpperBound);
        TextAsset     pickedLevel      = null;

        LinkedList <TextAsset> .Enumerator enumerator = listOfLevelsToPick.GetEnumerator();
        for (int i = 1; i < randomIndex; i++)
        {
            enumerator.MoveNext();
        }

        pickedLevel = enumerator.Current;
        if (pickedLevel == null)
        {
            return;
        }
        InitScriptName.InitScript.Instance.currentTarget = LevelData.loadLevelByTextAsset(pickedLevel);
        VideoManager.loadCustomizedData();
        SceneManager.LoadScene("game");
    }
Esempio n. 24
0
    // Use this for initialization
    void Start()
    {
        meshPos    = new Vector3(-1000, -1000, -10);
        dropTarget = transform.position;
        Meshes     = GameObject.Find("-Ball");
        launched   = false;
        setTarget  = false;
        newBall    = true;

        //TODO: Why is it bottom border +20? Editing doesn't seem to change anything
        bottomBorder = Camera.main.GetComponent <mainscript>().bottomBorder;
        topBorder    = Camera.main.GetComponent <mainscript>().topBorder;
        leftBorder   = Camera.main.GetComponent <mainscript>().leftBorder;
        rightBorder  = Camera.main.GetComponent <mainscript>().rightBorder;
        isPaused     = Camera.main.GetComponent <mainscript>().isPaused;

        //POPSign using the gray bubble instead of colorful bubbles.
        GetComponent <SpriteRenderer>().sprite = gameObject.GetComponent <ColorBallScript>().sprites[6];
        sharedVideoManager = VideoManager.getVideoManager();
    }
Esempio n. 25
0
        protected override void RunImpl()
        {
            #region Structural code

            Client client = new Client();

            Console.WriteLine("Client: Executing the client code with a real subject:");
            RealSubject realSubject = new RealSubject();
            client.ClientCode(realSubject);

            Console.WriteLine();

            Console.WriteLine("Client: Executing the same client code with a proxy:");
            Proxy proxy = new Proxy(realSubject);
            client.ClientCode(proxy);

            /***********************Output*******************************
             *      Client: Executing the client code with a real subject:
             *      RealSubject: Handling Request.
             *
             *      Client: Executing the same client code with a proxy:
             *      Proxy: Checking access prior to firing a real request.
             *      RealSubject: Handling Request.
             *      Proxy: Logging the time of request.
             **************************************************************/

            #endregion

            #region Sample

            var tvService = new TencentVideoService();

            var tvProxy = new CachedVideoService(tvService);

            var manager = new VideoManager(tvProxy);

            long videoId = 10;             //Get From User's input
            manager.ReactOnUserInput(videoId);

            #endregion
        }
Esempio n. 26
0
    private void Awake()
    {
        _songManager           = GetComponent <SongManager>();
        _audioManager          = GetComponent <AudioManager>();
        _propertiesManager     = GetComponent <PropertiesManager>();
        _videoManager          = GetComponent <VideoManager>();
        _timeGridManager       = GetComponent <TimeGridManager>();
        _objectsLibraryManager = GetComponent <ObjectsLibraryManager>();
        _dragSelectionHandler  = GetComponent <DragSelectionHandler>();

        _wave      = WaveWalls.Find("Wave").GetComponent <RectTransform>();
        _songWalls = WaveWalls.Find("Song Walls").GetComponent <RectTransform>();
        _timeGrid  = WaveWalls.Find("TimeGrid").GetComponent <RectTransform>();
        _cursor    = WaveWalls.Find("Song Walls/Cursor Song").GetComponent <RectTransform>();

        _renderSong = _wave.Find("RenderSong").GetComponent <RenderSong>();
        _mainCanvas = GetComponent <Canvas>();

        _wallObjects         = new List <WallObject>();
        _selectedWallObjects = new List <WallObject>();
    }
Esempio n. 27
0
        public static void StopStoryNode(GameObject rootGo)
        {
            if (rootGo == null)
            {
                return;
            }
            var root = rootGo.GetComponent <StoryData>();

            if (root == null)
            {
                return;
            }
            if (root.flowchart == null)
            {
                root.flowchart = rootGo.GetComponentInChildren <Fungus.Flowchart>();
            }
            root.flowchart.StopAllBlocks();
            var canvas = root.GetComponentsInChildren <Canvas>();

            foreach (var can in canvas)
            {
                if (!can.isRootCanvas)
                {
                    continue;
                }
                if (!can.name.Equals("Canvas"))
                {
                    continue;
                }
                can.gameObject.SetActive(false);
            }
            var video = rootGo.GetComponentInChildren <DisplayUGUI>();

            if (video != null)
            {
                VideoManager.GetInstance().Pause();
            }
            LJAudio.AudioManager.StopAllSound();
        }
Esempio n. 28
0
 void IVideoDevice.SetResolution(VideoManager sender, int width, int height)
 {
     if (this._surface != null)
     {
         this._surface.Dispose();
         this._surface = null;
     }
     this._surface = new SurfaceEx(width, height);
     if (base.Config.VideoMode > 0)
     {
         this._destinationSize      = this._sdlModes[base.Config.VideoMode - 1];
         this._stretchedSurface     = new SurfaceEx(this._destinationSize.Width, this._destinationSize.Height);
         this._sourceRectangle      = new Rectangle(0, 0, width, height);
         this._destinationRectangle = new Rectangle(0, 0, this._destinationSize.Width, this._destinationSize.Height);
     }
     else
     {
         this._destinationSize = new Size(width, height);
     }
     this.UpdateVideoSettings();
     base.VideoManager.SetVideoParams(new VideoParams(width, height, width, 32));
 }
Esempio n. 29
0
        public async Task GetMusicFile(DownloadMusicItem item, CancellationTokenSource token = null)
        {
            string nico_id = item.id;

            try
            {
                var videoManager = new VideoManager(cookieContainer, session.Session);
                var video_info   = await videoManager.GetVideoInfoAsync(nico_id);

                var video = await videoManager.GetVideoFlvAsync(nico_id);

                var    video_codec     = this.GetCodecExt(video.Url);
                string video_file_name = this.VideoToAudioConveter.GetVideoFileName(nico_id, video_codec);
                using (var stream = await video.GetVideoAsync(nico_id, cookieContainer))
                {
                    await this.VideoToAudioConveter.GetVideoFile(video_file_name, stream, token);

                    Logger.Current.WriteLine(string.Format("get video from {0} and saved to {1}", nico_id, video_file_name));
                }
                var    audio_codec   = this.GetAudioCodec(video_codec);
                string new_file_name = this.VideoToAudioConveter.GetAudioFileName(item.music_name, audio_codec);
                this.VideoToAudioConveter.GetAudioFile(video_file_name, new_file_name);

                File.Delete(video_file_name);

                Logger.Current.WriteLine(string.Format("get audio track from {0} and saved to {1}", video_file_name, new_file_name));
            }
            catch (TaskCanceledException)
            {
                Logger.Current.WriteLine(string.Format("canceled get video track from {0}", nico_id));
                return;
            }
            catch (Exception ex)
            {
                Logger.Current.WriteLine(string.Format("failed get audio track from {0}", nico_id));
                Logger.Current.WriteLine(ex.ToString());
                throw ex;
            }
        }
Esempio n. 30
0
        private void ResolutionChanged(VideoManager sender, int width, int height)
        {
            if (this.D3D == null || width < 1 || height < 1)
            {
                return;
            }
            int num  = (width > height) ? width : height;
            int num2 = 1;
            int num3;

            while ((num3 = RenderVideo.pow(2, num2)) < num)
            {
                num2++;
            }
            if (this._texture != null)
            {
                this._texture.Dispose();
                this._texture = null;
            }
            this._texture = new Texture(this.D3D, num3, num3, 1, Usage.None, Format.A8R8G8B8, Pool.Managed);
            this._videoManager.SetVideoParams(new VideoParams(width, height, num3, 32));
        }
Esempio n. 31
0
        private void callback(string html)
        {
            if (html.Contains("识别码搜寻结果"))
            {
                //<div class="video" id="vid_javlio354y"><a href="./?v=javlio354y" title="ABP-001 水咲ローラがご奉仕しちゃう超最新やみつきエステ"><div class="id">ABP-001</div>
                //http://www.javlibrary.com/cn/?v=javlio354y
                Regex regVideo  = new Regex("<div class=\"video\".*" + code + "</div>");
                var   videoItem = regVideo.Match(html);
                if (!string.IsNullOrEmpty(videoItem.Value))
                {
                    var m = new Regex("<a href=.* title=").Match(videoItem.Value);
                    var t = m.Value.Replace("\"", "").Replace("<a href=./", "").Replace(" title=", "");
                    HTMLHelper.GetInstance().GetHtml(string.Format("http://www.javlibrary.com/cn/{0}", t), this.callback);
                }
                else
                {
                    MessageBox.Show("找不到影片信息:" + code);
                }
            }
            else
            {
                CurrentVideo = VideoManager.GetInstance().CreateVideo(html, code);

                if (RegularHelper.IsUrl(CurrentVideo.ImgUrl))
                {
                    this.coverImg.Dispatcher.Invoke(new Action(delegate { this.coverImg.Source = new BitmapImage(new Uri(CurrentVideo.ImgUrl)); }));
                }
                else
                {
                    Logger.Error(string.Format("{0}的封面地址有误:{1}", CurrentVideo.Code, CurrentVideo.ImgUrl));
                }

                this.nameTextBox.Dispatcher.Invoke(new Action(delegate { this.nameTextBox.Text = CurrentVideo.Name; }));
                this.birthdayTextBox.Dispatcher.Invoke(new Action(delegate { this.birthdayTextBox.Text = CurrentVideo.Date.ToString("yyyy-MM-dd"); }));
                this.classTypeTextBox.Dispatcher.Invoke(new Action(delegate { this.classTypeTextBox.Text = CurrentVideo.GetClassString(); }));
                this.actressTextBox.Dispatcher.Invoke(new Action(delegate { this.actressTextBox.Text = CurrentVideo.GetActressString(); }));
            }
        }
Esempio n. 32
0
        public async Task <IActionResult> Create(
            [FromBody] Submission submission,
            [FromServices] Channel <EditVideoMessage> channel,
            [FromServices] VideoManager videoManager)
        {
            if (!videoManager.TemporaryVideoExists(submission.Video))
            {
                return(BadRequest());
            }

            submission.VideoProcessed = false;

            _dbContext.Add(submission);
            await _dbContext.SaveChangesAsync();

            await channel.Writer.WriteAsync(new EditVideoMessage
            {
                SubmissionId = submission.Id,
                Input        = submission.Video
            });

            return(Ok(submission));
        }
Esempio n. 33
0
        public static void Main()
        {
            string url         = "https://www.youtube.com/feeds/videos.xml?channel_id=UCLC-vbm7OWvpbqzXaoAMGGw";
            var    webClient   = new WebClient();
            string xmlFilePath = "../../info.xml";

            webClient.DownloadFile(url, xmlFilePath);

            var jsonProvider = new JsonProvider();
            var videoManager = new VideoManager();
            var htmlProvider = new HTMLProvider();

            string jsonRssContent = jsonProvider.GetJSONFromXml(xmlFilePath);

            var videos = videoManager.GetVideosFromJSON(jsonRssContent);

            string resultHTML = htmlProvider.BuildVideoInformationHTML(videos);

            string htmlFilePath = "../../result.html";

            File.WriteAllText(htmlFilePath, resultHTML);
            Console.WriteLine("Telerik rss feed videos have been succesfully saved in result.html");
        }
    protected void VideoCreatioFacebookWallPost()
    {
        string tributeHome;
        string videoUrl;
        if (TributesPortal.Utilities.WebConfig.ApplicationMode.Equals("local"))
        {
            tributeHome = Session["APP_PATH"] + _tributeUrl;
        }
        else
        {
            tributeHome = "http://" + _tributeType.Replace("New Baby", "newbaby").ToLower() + "." +
                WebConfig.TopLevelDomain + "/" + _tributeUrl;
        }
        tributeHome += "/";
        videoUrl = tributeHome + "Video.aspx";

        string query_string = string.Empty;
        if (TributesPortal.Utilities.WebConfig.ApplicationMode.Equals("local"))
        {
            query_string = "?TributeType=" + HttpUtility.UrlEncode(_tributeType);
            videoUrl = videoUrl + query_string;
            tributeHome = tributeHome + query_string;
        }
        aTributeHome.HRef = tributeHome;

        StateManager objStateManager = StateManager.Instance;
        if (Request.QueryString["post_on_facebook"] != null &&
            Request.QueryString["post_on_facebook"].ToString().Equals("True"))
        {
            if (Request.QueryString["videoId"] != null)
            {
                _videoId = int.Parse(Request.QueryString["videoId"].ToString());
                objStateManager.Add("VideoSession", _videoId, StateManager.State.Session);
            }
            else if (objStateManager.Get("VideoSession", StateManager.State.Session) != null)
            {
                _videoId = int.Parse(objStateManager.Get("VideoSession", StateManager.State.Session).ToString());
            }
            Videos objVideo = new Videos();
            objVideo.VideoId = _videoId;
            objVideo.UserId = _userId;
            VideoGallery objVideoGallery = new VideoGallery();
            objVideoGallery.Videos = objVideo;//this.View.UserTributeId
            VideoManager mgr = new VideoManager();
            objVideoGallery = mgr.GetVideoDetails(objVideoGallery);

            videoUrl += (videoUrl.Contains("?") ? "&" : "?") + "mode=view&videoId=" + _videoId.ToString();

            StringBuilder sb = new StringBuilder();
            sb.Append("<script type=\"text/javascript\">\n");
            sb.Append("$(document).addEvent('fb_connected', function() {\n");
            sb.Append("    var attachments = {\n");
            sb.Append("        name: '");
            sb.Append(string.Format("{0} added a video on the: {1} {2} Tribute", _userName, _tributeName, _tributeType));
            sb.Append("',\n");
            sb.Append("        href: '");
            sb.Append(videoUrl);
            sb.Append("',\n");
            sb.Append("        caption: '<b>Website:</b> ");
            sb.Append(tributeHome);
            sb.Append("',\n");
            sb.Append("        description: '<b>Video:</b> ");
            sb.Append(objVideoGallery.Videos.VideoCaption);
            sb.Append("',\n");
            sb.Append("        media: [{\n");
            sb.Append("          type: 'image',\n");
            sb.Append("          src:'");
            sb.Append(string.Format("http://img.youtube.com/vi/{0}/default.jpg", objVideoGallery.IdForDisplay));
            sb.Append("',\n");
            sb.Append("          href: '");
            sb.Append(videoUrl);
            sb.Append("'\n");
            sb.Append("               }]\n");
            sb.Append("    };\n");
            sb.Append("    var action_link = [{\n");
            sb.Append("        text: '");
            sb.Append(string.Format("Visit {0} Tribute", _tributeType));
            sb.Append("',\n");
            sb.Append("        href: '");
            sb.Append(tributeHome);
            sb.Append("'\n");
            sb.Append("    }]\n");
            sb.Append("    publish_stream('', attachments, action_link, null, null, function() {});");
            sb.Append("});\n");
            sb.Append("</script>");

            ClientScript.RegisterStartupScript(GetType(), "facebook_wall_post", sb.ToString());
        }
    }
Esempio n. 35
0
 private void InitVideoManager()
 {
     Console.WriteLine("开始初始化Video");
     videoManager = VideoManager.GetInstance();
     videoManager.Init(InitInfo);
 }