@@ -136,6 +136,47 @@ function stremioSubSizes(size) {
136
136
return false ;
137
137
}
138
138
139
+ var device = {
140
+ unsupportedAudio : [ 'DTS' , 'TRUEHD' ] ,
141
+ unsupportedSubs : [ 'HDMV/PGS' ]
142
+ } ;
143
+
144
+ var fetchedDeviceInfo = false ;
145
+
146
+ function retrieveDeviceInfo ( ) {
147
+ if ( fetchedDeviceInfo ) {
148
+ return ;
149
+ }
150
+ window . webOS . service . request ( 'luna://com.webos.service.config' , {
151
+ method : 'getConfigs' ,
152
+ parameters : {
153
+ 'configNames' : [
154
+ 'tv.model.edidType'
155
+ ]
156
+ } ,
157
+ onSuccess : function ( result ) {
158
+ if ( ( ( result || { } ) . configs || { } ) [ 'tv.model.edidType' ] ) {
159
+ fetchedDeviceInfo = true ;
160
+ var edidType = result . configs [ 'tv.model.edidType' ] . toLowerCase ( ) ;
161
+ if ( edidType . includes ( 'dts' ) ) {
162
+ device . unsupportedAudio = device . unsupportedAudio . filter ( function ( e ) {
163
+ return e !== 'DTS' ;
164
+ } ) ;
165
+ }
166
+ if ( edidType . includes ( 'truehd' ) ) {
167
+ device . unsupportedAudio = device . unsupportedAudio . filter ( function ( e ) {
168
+ return e !== 'TRUEHD' ;
169
+ } ) ;
170
+ }
171
+ }
172
+ } ,
173
+ onFailure : function ( err ) {
174
+ // eslint-disable-next-line no-console
175
+ console . log ( 'could not get deviceInfo' , err ) ;
176
+ }
177
+ } ) ;
178
+ }
179
+
139
180
function WebOsVideo ( options ) {
140
181
141
182
options = options || { } ;
@@ -318,6 +359,9 @@ function WebOsVideo(options) {
318
359
}
319
360
if ( ( ( tracksData || { } ) . subs || [ ] ) . length ) {
320
361
tracksData . subs . forEach ( function ( track ) {
362
+ if ( device . unsupportedSubs . includes ( track . codec || '' ) ) {
363
+ return ;
364
+ }
321
365
var textTrackId = nrSubs ;
322
366
nrSubs ++ ;
323
367
if ( ! currentSubTrack && ! textTracks . length ) {
@@ -337,6 +381,9 @@ function WebOsVideo(options) {
337
381
}
338
382
if ( ( ( tracksData || { } ) . audio || [ ] ) . length ) {
339
383
tracksData . audio . forEach ( function ( track ) {
384
+ if ( device . unsupportedAudio . includes ( track . codec || '' ) ) {
385
+ return ;
386
+ }
340
387
var audioTrackId = nrAudio ;
341
388
nrAudio ++ ;
342
389
if ( ! currentAudioTrack && ! audioTracks . length ) {
@@ -893,6 +940,7 @@ function WebOsVideo(options) {
893
940
if ( videoElement . mediaId ) {
894
941
clearInterval ( timer ) ;
895
942
retrieveExtendedTracks ( ) ;
943
+ retrieveDeviceInfo ( ) ;
896
944
cb ( ) ;
897
945
return ;
898
946
}
@@ -901,6 +949,7 @@ function WebOsVideo(options) {
901
949
// console.log('failed to get media id');
902
950
clearInterval ( timer ) ;
903
951
retrieveExtendedTracks ( ) ;
952
+ retrieveDeviceInfo ( ) ;
904
953
cb ( ) ;
905
954
}
906
955
}
0 commit comments