web-bugs icon indicating copy to clipboard operation
web-bugs copied to clipboard

sp.nicovideo.jp - video doesn't play

Open kudodo opened this issue 11 years ago • 17 comments

URL: http://sp.nicovideo.jp Browser / Version: Firefox 37.0.2 Operating System: Android Problem type: Video doesn't play

Steps to Reproduce

  1. Navigate to: http://sp.nicovideo.jp
  2. …

Expected Behavior: Video plays.

Actual Behavior: http://sp.nicovideo.jp/watch/sm26188376 for example, Firefox cannot play the video but chrome can play it inside the browser.

country: jp

kudodo avatar May 08 '15 08:05 kudodo

We need to find out why the video is not playing inside the browser.

On the contact side, Mozilla Japan seems to have contact. So after analysis, we can switch this bug to contactready.

karlcow avatar May 11 '15 08:05 karlcow

When going to http://sp.nicovideo.jp/watch/sm26188376 we get a play button, when we tap on it, we are redirected to a login page on Firefox for Android.

firefox-nicovideo

on iOS the menu is slightly more complex, but we get the same redirect for a login.

ios-nicovideo

After login, on Firefox Android, we get back to the page, then tapping play again, the wheel starts and stop. The player is at #jsPlayerGuideLayoutContainer. There is a defined tap area covering the video.

<div class="tap-area" id="jsTapArea"></div>

with an attach event touchend

function() {
  b.controller_view_model.toggleController()
}

once tapped we get a #jsPlayerLoadingContainer.

The video is already here in the DOM with a 1px by 1px size.

<div style="top: 0px;" class="player-video" id="jsPlayerVideo">
  <video style="height: 1px; width: 1px;" 
              src="http://smile-cln39.nicovideo.jp/smile?m=26188376.74686low" id="video">
  </video>
</div>

from the console when I force the video with window.location= 'http://smile-cln39.nicovideo.jp/smile?m=26188376.74686low' it plays. So there's something which is not working in the sequence of events. I haven't found yet what is blocking.

@hallvors Any ideas?

karlcow avatar May 11 '15 09:05 karlcow

I see code in "ScreenLayoutFactory" that appears to rely on window.orientation. I'll dig some more to see if this is the root cause.

hallvors avatar May 13 '15 07:05 hallvors

Mozilla Japan has contact, will contact them.

kudodo avatar May 13 '15 09:05 kudodo

I see code in "ScreenLayoutFactory" that appears to rely on window.orientation

If that turns out to be the case, I have some screen.orientation (actual web standard) code that we can share with them to use as a fallback for lack of window.orientation (non-standard).

miketaylr avatar May 13 '15 17:05 miketaylr

When requesting a page like http://sp.nicovideo.jp/watch/sm26143171?cp_in=wt_tp_recomuser_sherlock&rec_pos=4

<div id="jsDataContainer"
    data-watch_api_url="http://www.nicovideo.jp/watch/sm26143171?mode=sp_web_html5&amp;playlist_token=sm26143171_1431552568_77407a919760db308ee0b2e3451e5c8c57d4d8a4"
    data-flapi_url="http://flapi.nicovideo.jp/"
    data-spweb_url="http://sp.nicovideo.jp/"
    data-watch_id="sm26143171"
    data-video_id="sm26143171"
    data-thread_id="1430365146"
    data-default_thread_id="1430365146"
    data-is_channel="false"
    data-video_author_id="22957480"
    data-has_owner_thread="false"
    data-csrf_token="48291828_1431552568_3f21a0e77936a17d7d72187bb731382be301722"
    data-inline_playable="false">

When that last property meets this method:

a.prototype.setLayout = function(a) {
                var b = a.video_layout;
                this.context.inline_playable || (b.height = 1, b.width = 1), this.video_view.setLayout(b)

you end up with videos being 1x1 because they are not considered 'inline playable'.

The property in the HTML seems set by backend browser sniffing, it is fixed by adding an Android version number.

hallvors avatar May 13 '15 21:05 hallvors

(Issues are not entirely solved, however - the video doesn't start until you've tapped a few times)

hallvors avatar May 13 '15 21:05 hallvors

Seems Firefox doesn't fire the loadedmetadata event when the page expects. This is why it doesn't start auto-playing and needs a couple of extra taps.

Spec: https://html.spec.whatwg.org/multipage/embedded-content.html#event-media-loadedmetadata

Demo: go to http://www.w3.org/2010/05/video/mediaevents.html and click/tap the "load()" button. In other browsers, note how the counter for loadedmetadata goes up to 1 and the square turns green after a few seconds of loading. In Firefox this counter doesn't move until you click the play() button.

This causes the problem when nicovideo's watch/html5.min.js script does

    this.video_element.addEventListener("loadedmetadata", function() {
                    a.videoLoadeddata()
                })

and

            a.prototype.videoLoadeddata = function() {
                this.video_loaded = !0, this.checkLoadFinish()
            }

which is supposed to start the video.

hallvors avatar May 14 '15 13:05 hallvors

Moving bug to contactready - we need to ask them to fix the backend browser detection that sets data-inline_playable="false"

hallvors avatar May 14 '15 16:05 hallvors

FYI - here's a follow-up bug for the fix we need on our side: https://bugzilla.mozilla.org/show_bug.cgi?id=1165203

hallvors avatar May 15 '15 08:05 hallvors

I have sent a request to the person I know to introduce appropriate person to share this issue and its solutions.

chikoski avatar May 20 '15 05:05 chikoski

I have started to communicate with its developers.

chikoski avatar May 22 '15 00:05 chikoski

The fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1165203 is on inbound, so will likely land in Gecko very soon (unless it's backed out, of course).

miketaylr avatar Jun 17 '15 17:06 miketaylr

With nightly, I am now start the video without problem. However user comments that scroll on the video are not displayed.

kudodo avatar Jul 13 '15 10:07 kudodo

@kudodo I think we need a separate bug about that.

hallvors avatar Jul 14 '15 12:07 hallvors

Bug 1165203 - Video doesn't start on nicovideo.jp because we don't send a loadedmetadata event in response to video.load() is fixed

Next one to tackle is #1410

karlcow avatar Jul 23 '15 02:07 karlcow

I'm closing this one. Fixed through fixing the gecko bug.

karlcow avatar Jul 23 '15 02:07 karlcow