diff --git a/src/engines/html5/media-source/adapters/native-adapter.js b/src/engines/html5/media-source/adapters/native-adapter.js index 51fbe659b..3881334a7 100644 --- a/src/engines/html5/media-source/adapters/native-adapter.js +++ b/src/engines/html5/media-source/adapters/native-adapter.js @@ -9,6 +9,7 @@ import BaseMediaSourceAdapter from '../base-media-source-adapter' import {getSuitableSourceForResolution} from '../../../../utils/resolution' import * as Utils from '../../../../utils/util' import FairPlay from '../../../../drm/fairplay' +import Env from '../../../../utils/env' /** * An illustration of media source extension for progressive download @@ -378,13 +379,29 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { let paused = this._videoElement.paused; this._sourceObj = videoTracks[videoTrack.index]; this._eventManager.listenOnce(this._videoElement, Html5Events.LOADED_DATA, () => { - this._eventManager.listenOnce(this._videoElement, Html5Events.SEEKED, () => { - this._onTrackChanged(videoTrack); - }); - this._videoElement.currentTime = currentTime; + if (Env.browser.name === 'Android Browser') { + // In android browser we have to seek only after some playback. + this._eventManager.listenOnce(this._videoElement, Html5Events.DURATION_CHANGE, () => { + this._videoElement.currentTime = currentTime; + }); + this._eventManager.listenOnce(this._videoElement, Html5Events.SEEKED, () => { + this._onTrackChanged(videoTrack); + if (paused) { + this._videoElement.pause(); + } + }); + this._videoElement.play(); + } else { + this._eventManager.listenOnce(this._videoElement, Html5Events.SEEKED, () => { + this._onTrackChanged(videoTrack); + }); + this._videoElement.currentTime = currentTime; + if (!paused) { + this._videoElement.play(); + } + } }); this._videoElement.src = this._sourceObj ? this._sourceObj.url : ""; - paused ? this._videoElement.load() : this._videoElement.play(); } }