c# - WinForms - Embedding CNN Live Video URL -
i have c# winforms application , client has requested have streaming cnn video player integrated in it. cnn uses flash player located @ http://www.cnn.com/video/live/live.html?stream=stream1
however if embed webbrowser object , point @ url, web site wants fire popup outside of webbrowser control. if disable (using newwindow event handlers), throws javascript alert message. if allow it, opens new ie instance outside of application withe cnn video in it.
the thought had recreate html , override javascript settings flash object (http://z.cdn.turner.com/cnn/.element/apps/cnnlive/2.1.6.2/assets/scripts/liveplayersettings.js) in order turn off popup flags.
anyone have thoughts on way accomplish showing site while doing inside of application?
ended hacking javascript cnn uses, dunno how long it'll last quickest way accomplish wanted without added overhead of other solutions.
protected void webbrowser_progresschanged(object sender, webbrowserprogresschangedeventargs e) { if (webbrowser.readystate == webbrowserreadystate.complete && defaultpage == browserpage.cnn) { htmlelement head = webbrowser.document.getelementsbytagname("head")[0]; htmlelement scriptelement = webbrowser.document.createelement("script"); ihtmlscriptelement element = (ihtmlscriptelement)scriptelement.domelement; string popupblocker = "if(typeof settings != 'undefined') { settings.force_popup = false; }"; element.text = popupblocker; head.appendchild(scriptelement); } }
Comments
Post a Comment