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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 { | 368 { |
369 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); | 369 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); |
370 | 370 |
371 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); | 371 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); |
372 | 372 |
373 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) | 373 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) |
374 m_userGestureRequiredForPlay = true; | 374 m_userGestureRequiredForPlay = true; |
375 | 375 |
376 setHasCustomStyleCallbacks(); | 376 setHasCustomStyleCallbacks(); |
377 addElementToDocumentMap(this, &document); | 377 addElementToDocumentMap(this, &document); |
378 document.registerForTextTracksVisibilityChangedCallback(this); | |
379 #if OS(ANDROID) | |
tkent
2015/04/29 23:58:44
Can you set the default value of textTracksEnabled
srivats
2015/05/01 23:03:31
Doing that will have closed captions turned on by
| |
380 // The OS setting for closed captions state is only available on Android, iO S | |
381 // and OSX. Set closed captions visibility based on OS text tracks state onl y if the platform | |
382 // is Android because the setting is currently only plumbed down on Android. | |
383 setClosedCaptionsVisible(document.settings()->textTracksEnabled()); | |
tkent
2015/04/29 23:58:44
document.settings() can be NULL.
srivats
2015/05/01 23:03:31
Done.
| |
384 #endif | |
378 } | 385 } |
379 | 386 |
380 HTMLMediaElement::~HTMLMediaElement() | 387 HTMLMediaElement::~HTMLMediaElement() |
381 { | 388 { |
382 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); | 389 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); |
383 | 390 |
384 #if ENABLE(OILPAN) | 391 #if ENABLE(OILPAN) |
385 // If the HTMLMediaElement dies with the document we are not | 392 // If the HTMLMediaElement dies with the document we are not |
386 // allowed to touch the document to adjust delay load event counts | 393 // allowed to touch the document to adjust delay load event counts |
387 // because the document could have been already | 394 // because the document could have been already |
(...skipping 18 matching lines...) Expand all Loading... | |
406 m_textTracks->clearOwner(); | 413 m_textTracks->clearOwner(); |
407 m_audioTracks->shutdown(); | 414 m_audioTracks->shutdown(); |
408 m_videoTracks->shutdown(); | 415 m_videoTracks->shutdown(); |
409 | 416 |
410 if (m_mediaController) { | 417 if (m_mediaController) { |
411 m_mediaController->removeMediaElement(this); | 418 m_mediaController->removeMediaElement(this); |
412 m_mediaController = nullptr; | 419 m_mediaController = nullptr; |
413 } | 420 } |
414 #endif | 421 #endif |
415 | 422 |
423 document().unregisterFromTextTracksVisibilityChangedCallback(this); | |
424 | |
416 #if ENABLE(OILPAN) | 425 #if ENABLE(OILPAN) |
417 if (m_closeMediaSourceWhenFinalizing) | 426 if (m_closeMediaSourceWhenFinalizing) |
418 closeMediaSource(); | 427 closeMediaSource(); |
419 #else | 428 #else |
420 closeMediaSource(); | 429 closeMediaSource(); |
421 | 430 |
422 removeElementFromDocumentMap(this, &document()); | 431 removeElementFromDocumentMap(this, &document()); |
423 #endif | 432 #endif |
424 | 433 |
425 // Destroying the player may cause a resource load to be canceled, | 434 // Destroying the player may cause a resource load to be canceled, |
(...skipping 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3390 break; | 3399 break; |
3391 } | 3400 } |
3392 } | 3401 } |
3393 | 3402 |
3394 if (assumption == AssumeNoVisibleChange | 3403 if (assumption == AssumeNoVisibleChange |
3395 && m_haveVisibleTextTrack == haveVisibleTextTrack) { | 3404 && m_haveVisibleTextTrack == haveVisibleTextTrack) { |
3396 cueTimeline().updateActiveCues(currentTime()); | 3405 cueTimeline().updateActiveCues(currentTime()); |
3397 return; | 3406 return; |
3398 } | 3407 } |
3399 m_haveVisibleTextTrack = haveVisibleTextTrack; | 3408 m_haveVisibleTextTrack = haveVisibleTextTrack; |
3409 #if !OS(ANDROID) | |
3400 m_closedCaptionsVisible = m_haveVisibleTextTrack; | 3410 m_closedCaptionsVisible = m_haveVisibleTextTrack; |
3411 #else | |
3412 // Set closed captions visible during initial load only if the video has a | |
3413 // visible text track and when the android platform closed captions are enab led. | |
3414 m_closedCaptionsVisible = m_haveVisibleTextTrack && document().settings()->t extTracksEnabled(); | |
3415 #endif | |
3401 | 3416 |
3402 if (!m_haveVisibleTextTrack && !mediaControls()) | 3417 if (!m_haveVisibleTextTrack && !mediaControls()) |
3403 return; | 3418 return; |
3404 | 3419 |
3405 if (mediaControls()) | 3420 if (mediaControls()) |
3406 mediaControls()->changedClosedCaptionsVisibility(); | 3421 mediaControls()->changedClosedCaptionsVisibility(); |
3407 | 3422 |
3408 cueTimeline().updateActiveCues(currentTime()); | 3423 cueTimeline().updateActiveCues(currentTime()); |
3409 | 3424 |
3410 // Note: The "time marches on" algorithm (updateActiveCues) runs the "rules | 3425 // Note: The "time marches on" algorithm (updateActiveCues) runs the "rules |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3665 | 3680 |
3666 #if ENABLE(WEB_AUDIO) | 3681 #if ENABLE(WEB_AUDIO) |
3667 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3682 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3668 { | 3683 { |
3669 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) | 3684 if (!visitor->isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) |
3670 audioSourceProvider()->setClient(nullptr); | 3685 audioSourceProvider()->setClient(nullptr); |
3671 } | 3686 } |
3672 #endif | 3687 #endif |
3673 | 3688 |
3674 } | 3689 } |
OLD | NEW |