File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -543,6 +543,9 @@ shaka.util.Platform = class {
543543 * @return {boolean }
544544 */
545545 static isAndroid ( ) {
546+ if ( navigator . userAgentData && navigator . userAgentData . platform ) {
547+ return navigator . userAgentData . platform . toLowerCase ( ) == 'android' ;
548+ }
546549 return shaka . util . Platform . userAgentContains_ ( 'Android' ) ;
547550 }
548551
@@ -552,6 +555,9 @@ shaka.util.Platform = class {
552555 * @return {boolean }
553556 */
554557 static isFuchsia ( ) {
558+ if ( navigator . userAgentData && navigator . userAgentData . platform ) {
559+ return navigator . userAgentData . platform . toLowerCase ( ) == 'fuchsia' ;
560+ }
555561 return shaka . util . Platform . userAgentContains_ ( 'Fuchsia' ) ;
556562 }
557563
Original file line number Diff line number Diff line change @@ -193,6 +193,8 @@ describe('MediaCapabilities', () => {
193193 pending ( 'Unable to delete window.cast' ) ;
194194 }
195195
196+ spyOn ( shaka [ 'util' ] [ 'Platform' ] , 'isAndroid' ) . and . returnValue ( false ) ;
197+
196198 const isChromecastSpy =
197199 spyOn ( shaka [ 'util' ] [ 'Platform' ] ,
198200 'isChromecast' ) . and . returnValue ( true ) ;
@@ -218,6 +220,7 @@ describe('MediaCapabilities', () => {
218220 async ( ) => {
219221 // We only set the cast namespace, but not the canDisplayType() API.
220222 window [ 'cast' ] = { } ;
223+ spyOn ( shaka [ 'util' ] [ 'Platform' ] , 'isAndroid' ) . and . returnValue ( false ) ;
221224 const isChromecastSpy =
222225 spyOn ( shaka [ 'util' ] [ 'Platform' ] ,
223226 'isChromecast' ) . and . returnValue ( true ) ;
@@ -247,6 +250,7 @@ describe('MediaCapabilities', () => {
247250 window [ 'cast' ] = {
248251 __platform__ : { canDisplayType : mockCanDisplayType } ,
249252 } ;
253+ spyOn ( shaka [ 'util' ] [ 'Platform' ] , 'isAndroid' ) . and . returnValue ( false ) ;
250254 const isChromecastSpy =
251255 spyOn ( shaka [ 'util' ] [ 'Platform' ] ,
252256 'isChromecast' ) . and . returnValue ( true ) ;
You can’t perform that action at this time.
0 commit comments