1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
|
/******************************************************************************
QtAV: Multimedia framework based on Qt and FFmpeg
Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
* This file is part of QtAV (from 2013)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtAV 1.7
import QtQuick.Window 2.1
import QtQml 2.2
import "utils.js" as Utils
Rectangle {
id: root
layer.enabled: false
objectName: "root"
width: Screen.width
height: Screen.height
color: "black"
signal requestFullScreen
signal requestNormalSize
property bool play: false
property bool pause: false
property bool stop: true
property bool buffering: false
property string adaptationLogic: ""
property string videoURI: ""
property real alpha: 0
property real segmentBufferSize: 0
property bool icn: false
property real rateAlpha:0
property real bufferReservoirThreshold: 0
property real bufferMaxThreshold: 0
property real adaptechFirstThreshold: 0
property real adaptechSecondThreshold: 0
property real adaptechSwitchUpMargin: 0
property real adaptechSlackParameter: 0
property real adaptechAlpha: 0
property real bufferThreeThresholdFirst: 0
property real bufferThreeThresholdSecond: 0
property real bufferThreeThresholdThird: 0
property real pandaParamAlpha: 0
property real pandaParamBeta: 0
property real pandaParamBMin: 0
property real pandaParamK: 0
property real pandaParamW: 0
property real pandaParamEpsilon: 0
property real bolaBufferTarget: 0
property real bolaAlpha: 0
property int screenWidth: Screen.width
property int screenHeight: Screen.height
property int windowWidth: Window.width
property int pixDens: Math.ceil(Screen.pixelDensity)
property int itemWidth: 25 * pixDens
property int itemHeight: 10 * pixDens
property int scaledMargin: 2 * pixDens
property int fontSize: 5 * pixDens
property string platformName: Qt.platform.os
property bool isPlaying: false
property string graphStatus: "stop"
property bool hasMpd: false
property bool canBuffer: false
property alias keyboardFocus: myKeyboard.focus
property bool repeat: false
property bool graph: false
property bool enabledFullScreen: false
property bool autotune: false
property int lifetime: 0
property int retransmissions: 0
property real beta: 0
property real drop: 0
property real betaWifi: 0
property real dropWifi: 0
property int delayWifi: 0
property real betaLte: 0
property real dropLte: 0
property int delayLte: 0
property int batchingParameter: 0
property int rateEstimator: 0
function init(argv)
{
console.log("init>>>>>screen density logical: " + Screen.logicalPixelDensity + " pixel: " + Screen.pixelDensity);
}
function initGraph(initGraphValue)
{
graph = initGraphValue
}
function initRepeat(initRepeatValue)
{
repeat = initRepeatValue
}
function initFullScreen(initFullScreen)
{
enabledFullScreen = initFullScreen
}
function setPlay()
{
play = true
pause = false
stop = false
buffering = false
}
function setAdaptationLogic(initAdaptationLogic)
{
adaptationLogic = initAdaptationLogic
}
function setIcn(initIcn)
{
icn = initIcn
}
function setPause()
{
play = true
pause = true
stop = false
buffering = false
}
function startGraph()
{
graphPanel.startTimer()
}
function stopGraph()
{
graphPanel.stopTimer()
}
function pauseGraph()
{
graphPanel.pauseTimer()
}
function setStop()
{
control.setStopState()
}
function setBuffering()
{
canBuffer = true
}
function unSetBuffering()
{
canBuffer = false
}
VideoOutput2 {
id: videoOut
focus: false
opengl: true
fillMode: VideoOutput.PreserveAspectFit
anchors.fill: parent
source: player
orientation: 0
property real zoom: 1
}
AVPlayer {
id: player
objectName: "player"
autoPlay: true
videoCodecPriority: PlayerConfig.decoderPriorityNames
onPositionChanged: {
}
videoCapture {
}
onSourceChanged: {
videoOut.zoom = 1
videoOut.regionOfInterest = Qt.rect(0, 0, 0, 0)
}
onPlaying: {
control.setPlayingState()
}
onSeekFinished: {
}
onInternalAudioTracksChanged: {
}
onExternalAudioTracksChanged: {
}
onInternalSubtitleTracksChanged: {
}
onStopped: {
console.log("stopped ")
dashPlayer.onStopped(player.duration);
}
onPaused: {
console.log("else segment paused")
}
onError: {
if (error !== MediaPlayer.NoError) {
msg.error(errorString)
}
}
onVolumeChanged: {
}
onStatusChanged: {
}
onBufferProgressChanged: {
}
}
Subtitle {
id: subtitle
player: player
enabled: PlayerConfig.subtitleEnabled
autoLoad: PlayerConfig.subtitleAutoLoad
engines: PlayerConfig.subtitleEngines
delay: PlayerConfig.subtitleDelay
fontFile: PlayerConfig.assFontFile
fontFileForced: PlayerConfig.assFontFileForced
fontsDir: PlayerConfig.assFontsDir
onContentChanged: { //already enabled
}
onLoaded: {
msg.info(qsTr("Subtitle") + ": " + path.substring(path.lastIndexOf("/") + 1))
console.log(msg.text)
}
onSupportedSuffixesChanged: {
}
onEngineChanged: { // assume a engine canRender is only used as a renderer
subtitleItem.visible = canRender
subtitleLabel.visible = !canRender
}
onEnabledChanged: {
subtitleItem.visible = enabled
subtitleLabel.visible = enabled
}
}
Text {
id: msg
objectName: "msg"
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Utils.scaled(20)
style: Text.Outline
styleColor: "green"
color: "white"
anchors.top: root.top
width: root.width
height: root.height / 4
onTextChanged: {
msg_timer.stop()
visible = true
msg_timer.start()
}
Timer {
id: msg_timer
interval: 2000
onTriggered: msg.visible = false
}
function error(txt)
{
styleColor = "red"
text = txt
}
function info(txt)
{
styleColor = "green"
text = txt
}
}
Item {
id: myKeyboard
anchors.fill: parent
focus: true
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Escape:
break;
case Qt.Key_M:
break
case Qt.Key_Right:
break
case Qt.Key_Left:
break
case Qt.Key_Up:
break
case Qt.Key_Down:
break
case Qt.Key_Space:
break
case Qt.Key_Plus:
break;
case Qt.Key_Minus:
break;
case Qt.Key_F:
break
case Qt.Key_R:
break;
case Qt.Key_T:
break;
case Qt.Key_C:
break
case Qt.Key_A:
break
case Qt.Key_O:
break;
case Qt.Key_N:
break
case Qt.Key_B:
break;
case Qt.Key_G:
break;
case Qt.Key_Q:
if (event.modifiers & Qt.ControlModifier)
Qt.quit()
break;
}
}
}
DropArea {
anchors.fill: root
onEntered: {
if (!drag.hasUrls)
return;
console.log(drag.urls)
}
}
Text {
text: "Buffering..."
id: bufferingText
font.pointSize: 3*windowWidth*0.01;
color: "white"
font.family : "Helvetica"
opacity: canBuffer ? 1 : 0;
anchors.right: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
GraphPanel {
id: graphPanel
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.right
opacity: {
if (graph)
opacity = 0.9
else
opacity = 0
}
anchors.leftMargin: parent.width/2
anchors.bottomMargin: control.height
}
ControlPanel {
id: control
objectName: "control"
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
leftMargin: Utils.scaled(12)
rightMargin: Utils.scaled(12)
}
Behavior on opacity {NumberAnimation {duration: 300} }
onStartGraph: graphPanel.startTimer()
onStopGraph:graphPanel.stopTimer()
onPauseGraph:graphPanel.pauseTimer()
onDownloadMPD: mpdList.downloadMpd()
onOpenOptions: {
icn = dashPlayer.getIcn()
adaptationLogic = dashPlayer.getAdaptationLogic()
videoURI = dashPlayer.getVideoURI()
segmentBufferSize = dashPlayer.getSegmentBufferSize()
rateAlpha = dashPlayer.getRateAlpha()
bufferReservoirThreshold = dashPlayer.getBufferReservoirThreshold()
bufferMaxThreshold = dashPlayer.getBufferMaxThreshold()
adaptechFirstThreshold = dashPlayer.getAdaptechFirstThreshold()
adaptechSecondThreshold = dashPlayer.getAdaptechSecondThreshold()
adaptechSwitchUpMargin = dashPlayer.getAdaptechSwitchUpMargin()
adaptechSlackParameter = dashPlayer.getAdaptechSlackParameter()
adaptechAlpha = dashPlayer.getAdaptechAlpha()
bufferThreeThresholdFirst = dashPlayer.getBufferThreeThresholdFirst()
bufferThreeThresholdSecond = dashPlayer.getBufferThreeThresholdSecond()
bufferThreeThresholdThird = dashPlayer.getBufferThreeThresholdThird()
pandaParamAlpha = dashPlayer.getPandaParamAlpha()
pandaParamBeta = dashPlayer.getPandaParamBeta()
pandaParamBMin = dashPlayer.getPandaParamBMin()
pandaParamK = dashPlayer.getPandaParamK()
pandaParamW = dashPlayer.getPandaParamW()
pandaParamEpsilon = dashPlayer.getPandaParamEpsilon()
bolaBufferTarget = dashPlayer.getBolaBufferTarget()
bolaAlpha = dashPlayer.getBolaAlpha()
options.enabled = true
options.opacity = 0.9
enabled = false
}
onOpenOptionConnections: {
autotune = dashPlayer.getAutotune()
lifetime = dashPlayer.getLifetime()
retransmissions = dashPlayer.getRetransmissions()
alpha = dashPlayer.getAlpha()
console.log("alpha " + alpha)
beta = dashPlayer.getBeta()
drop = dashPlayer.getDrop()
betaWifi = dashPlayer.getBetaWifi()
dropWifi = dashPlayer.getDropWifi()
delayWifi = dashPlayer.getDelayWifi()
betaLte = dashPlayer.getBetaLte()
dropLte = dashPlayer.getDropLte()
delayLte = dashPlayer.getDelayLte()
batchingParameter = dashPlayer.getBatchingParameter()
rateEstimator = dashPlayer.getRateEstimator()
optionConnections.enabled = true
optionConnections.opacity = 0.9
enabled = false
}
onOpenGraph: {
graph = true
dashPlayer.setGraph(true)
graphPanel.opacity = 0.9
}
onHideGraph: {
graph = false
dashPlayer.setGraph(false)
graphPanel.opacity = 0
}
onRepeatVideo: {
repeat = true
dashPlayer.setRepeat(true)
}
onDonotRepeatVideo: {
repeat = false
dashPlayer.setRepeat(false)
}
onResizeWindowFullScreen: {
var xxx = Utils.scaled(Screen.width)
var yyy = Utils.scaled(Screen.height)
root.width = Utils.scaled(Window.width)
root.height = Utils.scaled(Window.height)
}
onResizeWindow: {
root.width = Utils.scaled(1024)
root.height = Utils.scaled(768)
}
onSaveFullScreen: {
enabledFullScreen = true
dashPlayer.setFullScreen(true)
}
onSaveExitFullScreen: {
enabledFullScreen = false
dashPlayer.setFullScreen(false)
}
onTogglePause: {
}
onOpenFile: {}
//IF_QT53
onOpenUrl: {}
MouseArea {
id: ma2
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onEntered: {
if(player.playbackState === MediaPlayer.PlayingState)
{
control.opacity = 1.0;
}
else
{
control.opacity = 1.0;
}
}
onExited: {
if(player.playbackState === MediaPlayer.PlayingState)
{
control.opacity = 0.0;
}
}
}
}
Options {
id: options
enabled: false
objectName: "openOption"
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
top: parent.top
topMargin: Utils.scaled(12)
bottomMargin: control.height + Utils.scaled(12)
leftMargin: Utils.scaled(12)
rightMargin: Utils.scaled(12)
}
onCloseOptions: {
control.uncheckOptionsBtn()
options.enabled = false
control.enabled = true
enabled = false;
opacity = 0
}
onSaveAdaptationLogic: {
dashPlayer.setAdaptationLogic(selectedAdaptationLogic)
adaptationLogic = selectedAdaptationLogic
}
onSaveIcn: {
dashPlayer.setIcn(selectedIcn)
icn = selectedIcn
}
onSaveVideoURI: {
dashPlayer.setVideoURI(selectedVideoURI)
videoURI = selectedVideoURI
}
onSaveSegmentBufferSize: {
dashPlayer.setSegmentBufferSize(selectedSegmentBufferSize)
segmentBufferSize = selectedSegmentBufferSize
}
onSaveRateAlpha: {
dashPlayer.setRateAlpha(selectedRateAlpha)
rateAlpha = selectedRateAlpha
}
onSaveBufferReservoirThreshold: {
dashPlayer.setBufferReservoirThreshold(selectedBufferReservoirThreshold)
bufferReservoirThreshold = selectedBufferReservoirThreshold
}
onSaveBufferMaxThreshold: {
dashPlayer.setBufferMaxThreshold(selectedBufferMaxThreshold)
bufferMaxThreshold = selectedBufferMaxThreshold
}
onSaveAdaptechFirstThreshold: {
dashPlayer.setAdaptechFirstThreshold(selectedAdaptechFirstThreshold)
adaptechFirstThreshold = selectedAdaptechFirstThreshold
}
onSaveAdaptechSecondThreshold: {
dashPlayer.setAdaptechSecondThreshold(selectedAdaptechSecondThreshold)
adaptechSecondThreshold = selectedAdaptechSecondThreshold
}
onSaveAdaptechSwitchUpMargin: {
dashPlayer.setAdaptechSwitchUpMargin(selectedAdaptechSwitchUpMargin)
adaptechSwitchUpMargin = selectedAdaptechSwitchUpMargin
}
onSaveAdaptechSlackParameter: {
dashPlayer.setAdaptechSlackParameter(selectedAdaptechSlackParameter)
adaptechSlackParameter = selectedAdaptechSlackParameter
}
onSaveAdaptechAlpha: {
dashPlayer.setAdaptechAlpha(selectedAdaptechAlpha)
adaptechAlpha = selectedAdaptechAlpha
}
onSaveBufferThreeThresholdFirst: {
dashPlayer.setBufferThreeThresholdFirst(selectedBufferThreeThresholdFirst)
bufferThreeThresholdFirst = selectedBufferThreeThresholdFirst
}
onSaveBufferThreeThresholdSecond: {
dashPlayer.setBufferThreeThresholdSecond(selectedBufferThreeThresholdSecond)
bufferThreeThresholdSecond = selectedBufferThreeThresholdSecond
}
onSaveBufferThreeThresholdThird: {
dashPlayer.setBufferThreeThresholdThird(selectedBufferThreeThresholdThird)
bufferThreeThresholdThird = selectedBufferThreeThresholdThird
}
onSavePandaParamAlpha: {
dashPlayer.setPandaParamAlpha(selectedPandaParamAlpha)
pandaParamAlpha = selectedPandaParamAlpha
}
onSavePandaParamBeta: {
dashPlayer.setPandaParamBeta(selectedPandaParamBeta)
pandaParamBeta = selectedPandaParamBeta
}
onSavePandaParamBMin: {
dashPlayer.setPandaParamBMin(selectedPandaParamBMin)
pandaParamBMin = selectedPandaParamBMin
}
onSavePandaParamK: {
dashPlayer.setPandaParamK(selectedPandaParamK)
pandaParamK = selectedPandaParamK
}
onSavePandaParamW: {
dashPlayer.setPandaParamW(selectedPandaParamW)
pandaParamW = selectedPandaParamW
}
onSavePandaParamEpsilon: {
dashPlayer.setPandaParamEpsilon(selectedPandaParamEpsilon)
pandaParamEpsilon = selectedPandaParamEpsilon
}
onSaveBolaBufferTarget: {
dashPlayer.setBolaBufferTarget(selectedBolaBufferTarget)
bolaBufferTarget = selectedBolaBufferTarget
}
onSaveBolaAlpha: {
dashPlayer.setBolaAlpha(selectedBolaAlpha)
bolaAlpha = selectedBolaAlpha
}
onReloadBufferBasedConf: {
bufferReservoirThreshold = dashPlayer.getBufferReservoirThreshold()
bufferMaxThreshold = dashPlayer.getBufferMaxThreshold()
}
onReloadBufferRateBasedConf:{
adaptechFirstThreshold = dashPlayer.getAdaptechFirstThreshold()
adaptechSecondThreshold = dashPlayer.getAdaptechSecondThreshold()
adaptechSwitchUpMargin = dashPlayer.getAdaptechSwitchUpMargin()
adaptechSlackParameter = dashPlayer.getAdaptechSlackParameter()
adaptechAlpha = dashPlayer.getAdaptechAlpha()
}
onReloadBufferThreeThresholdConf: {
bufferThreeThresholdFirst = dashPlayer.getBufferThreeThresholdFirst()
bufferThreeThresholdSecond = dashPlayer.getBufferThreeThresholdSecond()
bufferThreeThresholdThird = dashPlayer.getBufferThreeThresholdThird()
}
onReloadPandaConf: {
pandaParamAlpha = dashPlayer.getPandaParamAlpha()
pandaParamBeta = dashPlayer.getPandaParamBeta()
pandaParamBMin = dashPlayer.getPandaParamBMin()
pandaParamK = dashPlayer.getPandaParamK()
pandaParamW = dashPlayer.getPandaParamW()
pandaParamEpsilon = dashPlayer.getPandaParamEpsilon()
}
onReloadBolaConf: {
bolaBufferTarget = dashPlayer.getBolaBufferTarget()
}
}
OptionConnections {
id: optionConnections
enabled: false
objectName: "openOption"
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
top: parent.top
topMargin: Utils.scaled(12)
bottomMargin: control.height + Utils.scaled(12)
leftMargin: Utils.scaled(12)
rightMargin: Utils.scaled(12)
}
onCloseOptionConnections: {
control.uncheckOptionConnectionsBtn()
optionConnections.enabled = false
control.enabled = true
enabled = false;
opacity = 0
}
onSaveAutotune: {
dashPlayer.setAutotune(selectedAutotune)
autotune = selectedAutotune
}
onSaveLifetime: {
dashPlayer.setLifetime(selectedLifetime)
lifetime = selectedLifetime
}
onSaveRetransmissions: {
dashPlayer.setRetransmissions(selectedRetransmissions)
retransmissions = selectedRetransmissions
}
onSaveAlpha: {
dashPlayer.setAlpha(selectedAlpha)
alpha = selectedAlpha
}
onSaveBeta: {
dashPlayer.setBeta(selectedBeta)
beta = selectedBeta
}
onSaveDrop: {
dashPlayer.setDrop(selectedDrop)
drop = selectedDrop
}
onSaveBetaWifi: {
dashPlayer.setBetaWifi(selectedBetaWifi)
betaWifi = selectedBetaWifi
}
onSaveDropWifi: {
dashPlayer.setDropWifi(selectedDropWifi)
dropWifi = selectedDropWifi
}
onSaveDelayWifi: {
dashPlayer.setDelayWifi(selectedDelayWifi)
delayWifi = selectedDelayWifi
}
onSaveBetaLte: {
dashPlayer.setBetaLte(selectedBetaLte)
betaLte = selectedBetaLte
}
onSaveDropLte: {
dashPlayer.setDropLte(selectedDropLte)
dropLte = selectedDropLte
}
onSaveDelayLte: {
dashPlayer.setDelayLte(selectedDelayLte)
delayLte = selectedDelayLte
}
onSaveBatchingParameter: {
dashPlayer.setBatchingParameter(selectedBatchingParameter)
batchingParameter = selectedBatchingParameter
}
onSaveRateEstimator: {
dashPlayer.setRateEstimator(selectedRateEstimator)
rateAlpha = selectedRateEstimator
}
}
//IF_QT53
Dialog {
id: urlDialog
standardButtons: StandardButton.Open | StandardButton.Cancel
title: qsTr("Open a URL")
Rectangle {
color: "black"
anchors.top: parent.top
height: Utils.kItemHeight
width: parent.width
TextInput {
id: urlEdit
color: "orange"
font.pixelSize: Utils.kFontSize
anchors.fill: parent
}
}
onAccepted: player.source = urlEdit.displayText
}
//ENDIF_QT53
FileDialog {
id: fileDialog
title: "Please choose a media file"
selectMultiple: true
folder: PlayerConfig.lastFile
onAccepted: {
var sub, av
for (var i = 0; i < fileUrls.length; ++i)
{
var s = fileUrls[i].toString()
if (s.endsWith(".srt")
|| s.endsWith(".ass")
|| s.endsWith(".ssa")
|| s.endsWith(".sub")
|| s.endsWith(".idx") //vob
|| s.endsWith(".mpl2")
|| s.endsWith(".smi")
|| s.endsWith(".sami")
|| s.endsWith(".sup")
|| s.endsWith(".txt"))
sub = fileUrls[i]
else
av = fileUrls[i]
}
if (sub)
{
subtitle.autoLoad = false
subtitle.file = sub
} else
{
subtitle.autoLoad = PlayerConfig.subtitleAutoLoad
subtitle.file = ""
}
if (av)
{
player.source = av
PlayerConfig.lastFile = av
}
}
}
Connections {
target: Qt.application
onStateChanged: { //since 5.1
if (Qt.platform.os === "winrt" || Qt.platform.os === "winphone") //paused by system
return
// winrt is handled by system
switch (Qt.application.state) {
case Qt.ApplicationSuspended:
case Qt.ApplicationHidden:
player.pause()
break
default:
break
}
}
}
}
|