|
|
Hi.
I have a WMP inside a web page, which plays video files from web server over HTTP (so called progressive download). There is a pause before the actual playback starts, during which there is a black screen visible.
I would like to display the WMP only when the actual playback starts. I tried to do this with Buffering and PlayStateChange events, but they both proven to be unreliable indicators.
Is there any reliable way to discover that the actual playback has started and the video is visible?
Thanks in advance, Stas.
|
|
On Apr 19, 7:44 am, Stas <S...[ at ]discussions.microsoft.com> wrote:
[Quoted Text] > Hi. > > I have a WMP inside a web page, which plays video files from web server over > HTTP (so called progressive download). There is a pause before the actual > playback starts, during which there is a black screen visible. > > I would like to display the WMP only when the actual playback starts. I > tried to do this with Buffering and PlayStateChange events, but they both > proven to be unreliable indicators. > > Is there any reliable way to discover that the actual playback has started > and the video is visible? > > Thanks in advance, > Stas.
You can start a timer in javascript that kicks off every second (1000ms) and checks to see if the Player.Ctlcontrols.currentPosition has changed since the previous timer interval one second ago. As soon as you know that the currentPosition property has changed, then you know the file is progressing on actual video/audio. At that point, make sure you kill your javascript timer and un-hide the WMP by clearing the style property display:none on the object tag (or however you are hiding the WMP control during buffering). This way you can also dictate the max amount of time you will tolerate waiting, if nothing happens after 20 seconds of timer iterations for example, the timer can put up a user alert and halt the download and kill itself.
|
|
Hi.
Thanks, will give it a try. This is a better approach then what I'm doing currently, i.e., placing a timeout timer to display the div after fixed number of seconds, which is quite hit and miss.
By the way, shouldn't Player.Ctlcontrols be Player.Controls?
Regards, Stas.
"RickH" wrote:
[Quoted Text] > On Apr 19, 7:44 am, Stas <S...[ at ]discussions.microsoft.com> wrote: > > Hi. > > > > I have a WMP inside a web page, which plays video files from web server over > > HTTP (so called progressive download). There is a pause before the actual > > playback starts, during which there is a black screen visible. > > > > I would like to display the WMP only when the actual playback starts. I > > tried to do this with Buffering and PlayStateChange events, but they both > > proven to be unreliable indicators. > > > > Is there any reliable way to discover that the actual playback has started > > and the video is visible? > > > > Thanks in advance, > > Stas. > > You can start a timer in javascript that kicks off every second > (1000ms) and checks to see if the Player.Ctlcontrols.currentPosition > has changed since the previous timer interval one second ago. As soon > as you know that the currentPosition property has changed, then you > know the file is progressing on actual video/audio. At that point, > make sure you kill your javascript timer and un-hide the WMP by > clearing the style property display:none on the object tag (or however > you are hiding the WMP control during buffering). This way you can > also dictate the max amount of time you will tolerate waiting, if > nothing happens after 20 seconds of timer iterations for example, the > timer can put up a user alert and halt the download and kill itself. > > >
|
|
Hi.
I have "undefined" for the player.control object (player object is fine). I embed the media player via external JS to prevent the "click here to activate this control" message.
Any idea?
Thanks, Stas.
"Stas" wrote:
[Quoted Text] > "RickH" wrote: > > > On Apr 19, 7:44 am, Stas <S...[ at ]discussions.microsoft.com> wrote: > > > Hi. > > > > > > I have a WMP inside a web page, which plays video files from web server over > > > HTTP (so called progressive download). There is a pause before the actual > > > playback starts, during which there is a black screen visible. > > > > > > I would like to display the WMP only when the actual playback starts. I > > > tried to do this with Buffering and PlayStateChange events, but they both > > > proven to be unreliable indicators. > > > > > > Is there any reliable way to discover that the actual playback has started > > > and the video is visible? > > > > > > Thanks in advance, > > > Stas. > > > > You can start a timer in javascript that kicks off every second > > (1000ms) and checks to see if the Player.Ctlcontrols.currentPosition > > has changed since the previous timer interval one second ago. As soon > > as you know that the currentPosition property has changed, then you > > know the file is progressing on actual video/audio. At that point, > > make sure you kill your javascript timer and un-hide the WMP by > > clearing the style property display:none on the object tag (or however > > you are hiding the WMP control during buffering). This way you can > > also dictate the max amount of time you will tolerate waiting, if > > nothing happens after 20 seconds of timer iterations for example, the > > timer can put up a user alert and halt the download and kill itself. > > > > > >
|
|
Yes, you are using either Firefox without the new WMP control plugin, or you are using the old CLASSID starting "CLSID:22...." which is for WMP6.4 and that player doesn't have a controls object.
You should instead post your embedding code sample so we don't have to guess what the problem might be. Incidentally, you don't need to write the actual player using javascript, I've a small code sample which is supposed to be used to replace objects in IE anyway, and it's modified to make the embedding XHTML compatible (works in FF and Safari) and adjust the player objects for IE by adding the CLASSID.
HTH Cheers - Neil
On Wed, 25 Apr 2007 07:08:06 -0700, Stas <Stas[ at ]discussions.microsoft.com> wrote:
[Quoted Text] >Hi. > >I have "undefined" for the player.control object (player object is fine). I >embed the media player via external JS to prevent the "click here to activate >this control" message. > >Any idea? > >Thanks, >Stas. > >"Stas" wrote: > >> "RickH" wrote: >> >> > On Apr 19, 7:44 am, Stas <S...[ at ]discussions.microsoft.com> wrote: >> > > Hi. >> > > >> > > I have a WMP inside a web page, which plays video files from web server over >> > > HTTP (so called progressive download). There is a pause before the actual >> > > playback starts, during which there is a black screen visible. >> > > >> > > I would like to display the WMP only when the actual playback starts. I >> > > tried to do this with Buffering and PlayStateChange events, but they both >> > > proven to be unreliable indicators. >> > > >> > > Is there any reliable way to discover that the actual playback has started >> > > and the video is visible? >> > > >> > > Thanks in advance, >> > > Stas. >> > >> > You can start a timer in javascript that kicks off every second >> > (1000ms) and checks to see if the Player.Ctlcontrols.currentPosition >> > has changed since the previous timer interval one second ago. As soon >> > as you know that the currentPosition property has changed, then you >> > know the file is progressing on actual video/audio. At that point, >> > make sure you kill your javascript timer and un-hide the WMP by >> > clearing the style property display:none on the object tag (or however >> > you are hiding the WMP control during buffering). This way you can >> > also dictate the max amount of time you will tolerate waiting, if >> > nothing happens after 20 seconds of timer iterations for example, the >> > timer can put up a user alert and halt the download and kill itself. >> > >> > >> >
------------------------------------------------ Digital Media MVP : 2004-2007 http://mvp.support.microsoft.com/mvpfaqs
|
|
You might be right, it's because of incorrect object embedding. Here is the code sample:
embedObject('<embed type="video/x-ms-wmv" src="http://localhost/test.wmv"' + 'width="320"' + 'height="240"' + 'autostart="1"' + 'showcontrols="0">' + '</embed>');
embedObject() just document.write()'s the passed string.
Could you paste your code sample?
Thanks, Stas.
"Neil Smith [MVP Digital Media]" wrote:
[Quoted Text] > Yes, you are using either Firefox without the new WMP control plugin, > or you are using the old CLASSID starting "CLSID:22...." which is for > WMP6.4 and that player doesn't have a controls object. > > You should instead post your embedding code sample so we don't have to > guess what the problem might be. Incidentally, you don't need to write > the actual player using javascript, I've a small code sample which is > supposed to be used to replace objects in IE anyway, and it's modified > to make the embedding XHTML compatible (works in FF and Safari) and > adjust the player objects for IE by adding the CLASSID. > > HTH > Cheers - Neil > >
|
|
On Apr 24, 12:48 pm, Stas <S...[ at ]discussions.microsoft.com> wrote:
[Quoted Text] > Hi. > > Thanks, will give it a try. This is a better approach then what I'm doing > currently, i.e., placing a timeout timer to display the div after fixed > number of seconds, which is quite hit and miss. > > By the way, shouldn't Player.Ctlcontrols be Player.Controls? > > Regards, > Stas. > > > > "RickH" wrote: > > On Apr 19, 7:44 am, Stas <S...[ at ]discussions.microsoft.com> wrote: > > > Hi. > > > > I have a WMP inside a web page, which plays video files from web server over > > > HTTP (so called progressive download). There is a pause before the actual > > > playback starts, during which there is a black screen visible. > > > > I would like to display the WMP only when the actual playback starts. I > > > tried to do this with Buffering and PlayStateChange events, but they both > > > proven to be unreliable indicators. > > > > Is there any reliable way to discover that the actual playback has started > > > and the video is visible? > > > > Thanks in advance, > > > Stas. > > > You can start a timer in javascript that kicks off every second > > (1000ms) and checks to see if the Player.Ctlcontrols.currentPosition > > has changed since the previous timer interval one second ago. As soon > > as you know that the currentPosition property has changed, then you > > know the file is progressing on actual video/audio. At that point, > > make sure you kill your javascript timer and un-hide the WMP by > > clearing the style property display:none on the object tag (or however > > you are hiding the WMP control during buffering). This way you can > > also dictate the max amount of time you will tolerate waiting, if > > nothing happens after 20 seconds of timer iterations for example, the > > timer can put up a user alert and halt the download and kill itself.- Hide quoted text - > > - Show quoted text -
Yes, on the scripting interface its player.controls, on the winforms interface its ctlControls because the Controls property is already in the base class for an entirely different reason. I'm more used to winForms.
|
|
|