| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2492 m_lastTimeUpdateEventWallTime = now; | 2492 m_lastTimeUpdateEventWallTime = now; |
| 2493 m_lastTimeUpdateEventMovieTime = movieTime; | 2493 m_lastTimeUpdateEventMovieTime = movieTime; |
| 2494 } | 2494 } |
| 2495 } | 2495 } |
| 2496 | 2496 |
| 2497 bool HTMLMediaElement::canPlay() const | 2497 bool HTMLMediaElement::canPlay() const |
| 2498 { | 2498 { |
| 2499 return paused() || ended() || m_readyState < HAVE_METADATA; | 2499 return paused() || ended() || m_readyState < HAVE_METADATA; |
| 2500 } | 2500 } |
| 2501 | 2501 |
| 2502 double HTMLMediaElement::percentLoaded() const | |
| 2503 { | |
| 2504 if (!m_player) | |
| 2505 return 0; | |
| 2506 double duration = m_player->duration(); | |
| 2507 | |
| 2508 if (!duration || std::isinf(duration)) | |
| 2509 return 0; | |
| 2510 | |
| 2511 double buffered = 0; | |
| 2512 RefPtr<TimeRanges> timeRanges = m_player->buffered(); | |
| 2513 for (unsigned i = 0; i < timeRanges->length(); ++i) { | |
| 2514 double start = timeRanges->start(i, IGNORE_EXCEPTION); | |
| 2515 double end = timeRanges->end(i, IGNORE_EXCEPTION); | |
| 2516 buffered += end - start; | |
| 2517 } | |
| 2518 return buffered / duration; | |
| 2519 } | |
| 2520 | |
| 2521 void HTMLMediaElement::mediaPlayerDidAddTrack(WebInbandTextTrack* webTrack) | 2502 void HTMLMediaElement::mediaPlayerDidAddTrack(WebInbandTextTrack* webTrack) |
| 2522 { | 2503 { |
| 2523 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2504 if (!RuntimeEnabledFeatures::videoTrackEnabled()) |
| 2524 return; | 2505 return; |
| 2525 | 2506 |
| 2526 // 4.8.10.12.2 Sourcing in-band text tracks | 2507 // 4.8.10.12.2 Sourcing in-band text tracks |
| 2527 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. | 2508 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. |
| 2528 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), this
, webTrack); | 2509 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), this
, webTrack); |
| 2529 | 2510 |
| 2530 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, | 2511 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3981 { | 3962 { |
| 3982 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3963 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
| 3983 } | 3964 } |
| 3984 | 3965 |
| 3985 bool HTMLMediaElement::isInteractiveContent() const | 3966 bool HTMLMediaElement::isInteractiveContent() const |
| 3986 { | 3967 { |
| 3987 return fastHasAttribute(controlsAttr); | 3968 return fastHasAttribute(controlsAttr); |
| 3988 } | 3969 } |
| 3989 | 3970 |
| 3990 } | 3971 } |
| OLD | NEW |