Bug 34318 - [GStreamer][WK2] Should show an error to the user if something goes wrong
Summary: [GStreamer][WK2] Should show an error to the user if something goes wrong
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 34760 96170 (view as bug list)
Depends on:
Blocks: 34085
  Show dependency treegraph
 
Reported: 2010-01-29 01:51 PST by Sebastian Dröge (slomo)
Modified: 2021-04-14 06:28 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Dröge (slomo) 2010-01-29 01:51:56 PST
Hi,
the GStreamer media stuff in WebKit currently silently stops playback if an error happens. Instead it should show an error to the user. An error can be produced by using the patch from #34317 and trying to seek in a video on vimeo.com (it doesn't allow range requests).
Comment 1 Philippe Normand 2010-02-10 00:08:47 PST
*** Bug 34760 has been marked as a duplicate of this bug. ***
Comment 2 Philippe Normand 2010-02-10 00:09:47 PST
It also silently fails if no audio sink could be created by playbin2
Comment 3 Sebastian Dröge (slomo) 2010-02-12 07:29:14 PST
kov said, that there should be a per-frame or per-view (I'd vote for per-view) object, that has signals for errors and which can be used to control the volume and stuff from the application.

Sounds like the way to go IMHO
Comment 4 Sebastian Dröge (slomo) 2010-02-12 07:41:40 PST
Proposed API, for the errors at least:

WebKitMediaPlayerController:
 Signals:
   void error (GObject *o, GError *error, const gchar *debug)
   void warning (GObject *o, GError *error, const gchar *debug)
   void info (GObject *o, GError *error, const gchar *debug)

WebKitWebView:
 Methods:
  web_kit_web_view_get_media_player_controller (WebKitWebView *view)


Later this could be extended to also have methods like:
  void web_kit_media_player_controller_set_volume(WebKitMediaPlayerController *controller, gdouble vol)
  gdouble web_kit_media_player_controller_get_volume(WebKitMediaPlayerController *controller)
  [...]


Not sure if setting volume this way is a good idea though, it would mean that all media players in the current view have the same volume. There must be a better API for volume ;)
Comment 5 Philippe Normand 2010-02-12 10:07:03 PST
I see other ports implementing a MediaPlayerProxy.. Maybe we could take inspiration from that?
Comment 6 Philippe Normand 2010-02-15 02:06:09 PST
(In reply to comment #4)
> Proposed API, for the errors at least:
> 
...
> 
> Not sure if setting volume this way is a good idea though, it would mean that
> all media players in the current view have the same volume. There must be a
> better API for volume ;)

What about naming it "global volume" or something like that? So one could set the view volume on a global basis and then tweak it using the <video> controls UI if needed.
Comment 7 Philippe Normand 2010-12-07 04:48:05 PST
After discussing with Gustavo during the WebKitGTK+ hackfest, here is a proposed plan (I hope I got it right :D).

At WebKit level we'd like to be notified of the MediaPlayer various state changes, errors and so on. The idea is to add a new class in WebCore called MediaPlayerPlatformClient, attached to the MediaPlayer. In the case of the GTK+ port there would be a WebMediaPlayerClientGtk in WebCoreSupport which would create a GObject that can be delivered by a WebView signal each time a new MediaPlayer is created.

Here's a dump of my notes about the proposed changes:

WebCore
=======

MediaPlayer:
------------

  when created get the ChromeClient and call ::mediaPlayerCreated()

  public:
    MediaPlayerPlatformClient* platformClient() const;

  private:
    MediaPlayerPlatformClient* m_platformClient;

ChromeClient:
-------------

virtual mediaPlayerCreated(Frame*, MediaPlayer*);

MediaPlayerPlatformClient:
--------------------------

#if ENABLE(GLIB_SUPPORT)
  handleError(GError*) { m_client->handleError(err) }
  handleInfo(...)
  handleWarning(...)
#endif

  volume notifications
  state notifications
  ... like MediaPlayer API

  created(Frame*);

  private:
    MediaPlayer* m_player;



MediaPlayerPrivateGStreamer:
----------------------------

example use-case:

  m_player->platformClient()->handleError(err)

WebKit/gtk/WebCoreSupport
=========================

ChromeClientGtk:
----------------

mediaPlayerCreated(Frame*, MediaPlayer*) {
   playerClient = new WebKitMediaPlayerClient();
   mediaPlayer->platformClient()->setWebKitMediaPlayerPlatformClient(playerClient);
   g_signal_emit(webView, "media-player-created", playerClient);
}



WebMediaPlayerClientGtk:
------------------------

  public:
    setWebKitMediaPlayerPlatformClient(WebKitMediaPlayerClient*);
    handleError(GError*) { g_signal_emit(m_webkitMediaPlayerClient, "error", ...); }

  private:
    WebKitMediaPlayerClient* m_webkitMediaPlayerClient;

WebKit/gtk/webkit
=================

WebKitMediaPlayerClient:
 Signals:
   void error (GObject *o, GError *error, const gchar *debug)
   void warning (GObject *o, GError *error, const gchar *debug)
   void info (GObject *o, GError *error, const gchar *debug)


WebKitWebView:
 Signal:
  media-player-created(WebKitMediaPlayerClient*)
Comment 8 Philippe Normand 2010-12-08 03:39:05 PST
What do you think about this proposal Eric?
Comment 9 Priit Laes (IRC: plaes) 2011-04-24 07:42:54 PDT
Does this proposal also cover reporting about missing plugins?
Comment 10 Sebastian Dröge (slomo) 2011-04-26 07:03:57 PDT
Not really, that requires different handling of the error messages.
Comment 11 Xabier Rodríguez Calvar 2012-06-15 04:33:01 PDT
I will have a look at this, but I cannot promise to complete the job because of lack of time.
Comment 12 Philippe Normand 2012-09-13 09:11:48 PDT
*** Bug 96170 has been marked as a duplicate of this bug. ***
Comment 13 Danilo de Paula 2013-09-17 12:19:50 PDT
Is there anyone still working on this?
Comment 14 Philippe Normand 2013-09-18 00:31:39 PDT
We should do this for WK2.
Comment 15 Philippe Normand 2013-09-18 00:33:23 PDT
(In reply to comment #13)
> Is there anyone still working on this?

Nope!
Comment 16 Xabier Rodríguez Calvar 2021-04-14 06:28:02 PDT
AFAIK errors are reported to JS as expected.