feat:hls流误删导致视频报错,作业资料接口对接,逻辑处理下载,课程列表按钮按照 后端请求分为需传token 和不需要根据是否登录判断
202
public/ckplayer/LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
1609
public/ckplayer/css/ckplayer.css
Normal file
1707
public/ckplayer/css/ckplayer.ixigua.css
Normal file
1609
public/ckplayer/css/ckplayer.red.css
Normal file
BIN
public/ckplayer/css/images/adclose.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
public/ckplayer/css/images/buffer.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
public/ckplayer/css/images/ckplayer.48.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/ckplayer/css/images/ckplayer.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/ckplayer/css/images/ckplayer_ixigua.48.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
public/ckplayer/css/images/ckplayer_ixigua.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/ckplayer/css/images/ckplayer_red.48.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/ckplayer/css/images/ckplayer_red.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/ckplayer/css/images/loading.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
public/ckplayer/css/images/logo.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
public/ckplayer/css/images/play.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
202
public/ckplayer/flv.js/LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
104
public/ckplayer/flv.js/README.md
Normal file
@ -0,0 +1,104 @@
|
||||
|
||||
flv.js [](https://www.npmjs.com/package/flv.js)
|
||||
======
|
||||
An HTML5 Flash Video (FLV) Player written in pure JavaScript without Flash. LONG LIVE FLV!
|
||||
|
||||
This project relies on [Media Source Extensions][] to work.
|
||||
|
||||
**For FLV live stream playback, please consider [mpegts.js][] which is under active development.**
|
||||
|
||||
**This project will become rarely maintained.**
|
||||
|
||||
[mpegts.js]: https://github.com/xqq/mpegts.js
|
||||
## Overview
|
||||
flv.js works by transmuxing FLV file stream into ISO BMFF (Fragmented MP4) segments, followed by feeding mp4 segments into an HTML5 `<video>` element through [Media Source Extensions][] API.
|
||||
|
||||
[Media Source Extensions]: https://w3c.github.io/media-source/
|
||||
|
||||
## Demo
|
||||
[http://bilibili.github.io/flv.js/demo/](http://bilibili.github.io/flv.js/demo/)
|
||||
|
||||
## Features
|
||||
- FLV container with H.264 + AAC / MP3 codec playback
|
||||
- Multipart segmented video playback
|
||||
- HTTP FLV low latency live stream playback
|
||||
- FLV over WebSocket live stream playback
|
||||
- Compatible with Chrome, FireFox, Safari 10, IE11 and Edge
|
||||
- Extremely low overhead, and hardware accelerated by your browser!
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
npm install --save flv.js
|
||||
```
|
||||
|
||||
## Build
|
||||
```bash
|
||||
npm ci # install dependencies / dev-dependences
|
||||
npm run build:debug # debug version flv.js will be emitted to /dist
|
||||
npm run build # minimized release version flv.min.js will be emitted to /dist
|
||||
```
|
||||
|
||||
[cnpm](https://github.com/cnpm/cnpm) mirror is recommended if you are in Mainland China.
|
||||
|
||||
## CORS
|
||||
If you use standalone video server for FLV stream, `Access-Control-Allow-Origin` header must be configured correctly on video server for cross-origin resource fetching.
|
||||
|
||||
See [cors.md](docs/cors.md) for more details.
|
||||
|
||||
## Getting Started
|
||||
```html
|
||||
<script src="flv.min.js"></script>
|
||||
<video id="videoElement"></video>
|
||||
<script>
|
||||
if (flvjs.isSupported()) {
|
||||
var videoElement = document.getElementById('videoElement');
|
||||
var flvPlayer = flvjs.createPlayer({
|
||||
type: 'flv',
|
||||
url: 'http://example.com/flv/video.flv'
|
||||
});
|
||||
flvPlayer.attachMediaElement(videoElement);
|
||||
flvPlayer.load();
|
||||
flvPlayer.play();
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## Limitations
|
||||
- MP3 audio codec is currently not working on IE11 / Edge
|
||||
- HTTP FLV live stream is not currently working on all browsers, see [livestream.md](docs/livestream.md)
|
||||
|
||||
## Multipart playback
|
||||
You only have to provide a playlist for `MediaDataSource`. See [multipart.md](docs/multipart.md)
|
||||
|
||||
## Livestream playback
|
||||
See [livestream.md](docs/livestream.md)
|
||||
|
||||
## API and Configuration
|
||||
See [api.md](docs/api.md)
|
||||
|
||||
## Debug
|
||||
```bash
|
||||
npm ci # install dependencies / dev-dependences
|
||||
npm run dev # watch file changes and build debug version on the fly
|
||||
```
|
||||
|
||||
## Design
|
||||
See [design.md](docs/design.md)
|
||||
|
||||
## License
|
||||
```
|
||||
Copyright (C) 2016 Bilibili. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
```
|
||||
|
10585
public/ckplayer/flv.js/flv.js
Normal file
1
public/ckplayer/flv.js/flv.js.map
Normal file
10
public/ckplayer/flv.js/flv.min.js
vendored
Normal file
1
public/ckplayer/flv.js/flv.min.js.map
Normal file
28
public/ckplayer/hls.js/LICENSE
Normal file
@ -0,0 +1,28 @@
|
||||
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
|
||||
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
|
||||
|
||||
That work is also covered by the Apache 2 License, following copyright:
|
||||
Copyright (c) 2013-2015 Brightcove
|
||||
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
442
public/ckplayer/hls.js/README.md
Normal file
@ -0,0 +1,442 @@
|
||||
[](https://npmjs.org/package/hls.js)
|
||||
[](https://www.npmjs.com/package/hls.js/v/canary)
|
||||
[](https://www.jsdelivr.com/package/npm/hls.js)
|
||||
[](https://app.saucelabs.com/u/robwalch)
|
||||
|
||||
[comment]: <> ([](https://saucelabs.com/u/robwalch))
|
||||
|
||||
# 
|
||||
|
||||
HLS.js is a JavaScript library that implements an [HTTP Live Streaming] client.
|
||||
It relies on [HTML5 video][] and [MediaSource Extensions][] for playback.
|
||||
|
||||
It works by transmuxing MPEG-2 Transport Stream and AAC/MP3 streams into ISO BMFF (MP4) fragments.
|
||||
Transmuxing is performed asynchronously using a [Web Worker] when available in the browser.
|
||||
HLS.js also supports HLS + fmp4, as announced during [WWDC2016](https://developer.apple.com/videos/play/wwdc2016/504/).
|
||||
|
||||
HLS.js works directly on top of a standard HTML`<video>` element.
|
||||
|
||||
HLS.js is written in [ECMAScript6] (`*.js`) and [TypeScript] (`*.ts`) (strongly typed superset of ES6), and transpiled in ECMAScript5 using [Babel](https://babeljs.io/) and the [TypeScript compiler].
|
||||
|
||||
[Webpack] is used to build the distro bundle and serve the local development environment.
|
||||
|
||||
[html5 video]: https://www.html5rocks.com/en/tutorials/video/basics/
|
||||
[mediasource extensions]: https://w3c.github.io/media-source/
|
||||
[http live streaming]: https://en.wikipedia.org/wiki/HTTP_Live_Streaming
|
||||
[web worker]: https://caniuse.com/#search=worker
|
||||
[ecmascript6]: https://github.com/ericdouglas/ES6-Learning#articles--tutorials
|
||||
[typescript]: https://www.typescriptlang.org/
|
||||
[typescript compiler]: https://www.typescriptlang.org/docs/handbook/compiler-options.html
|
||||
[webpack]: https://webpack.js.org/
|
||||
|
||||
## Features
|
||||
|
||||
- VOD & Live playlists
|
||||
- DVR support on Live playlists
|
||||
- Fragmented MP4 container
|
||||
- MPEG-2 TS container
|
||||
- ITU-T Rec. H.264 and ISO/IEC 14496-10 Elementary Stream
|
||||
- ISO/IEC 13818-7 ADTS AAC Elementary Stream
|
||||
- ISO/IEC 11172-3 / ISO/IEC 13818-3 (MPEG-1/2 Audio Layer III) Elementary Stream
|
||||
- Packetized metadata (ID3v2.3.0) Elementary Stream
|
||||
- AAC container (audio only streams)
|
||||
- MPEG Audio container (MPEG-1/2 Audio Layer III audio only streams)
|
||||
- Timed Metadata for HTTP Live Streaming (in ID3 format, carried in MPEG-2 TS)
|
||||
- AES-128 decryption
|
||||
- SAMPLE-AES decryption (only supported if using MPEG-2 TS container)
|
||||
- Encrypted media extensions (EME) support for DRM (digital rights management)
|
||||
- Widevine CDM (only tested with [shaka-packager](https://github.com/google/shaka-packager) test-stream on [the demo page](https://hls-js.netlify.app/demo/?src=https%3A%2F%2Fstorage.googleapis.com%2Fshaka-demo-assets%2Fangel-one-widevine-hls%2Fhls.m3u8&demoConfig=eyJlbmFibGVTdHJlYW1pbmciOnRydWUsImF1dG9SZWNvdmVyRXJyb3IiOnRydWUsInN0b3BPblN0YWxsIjpmYWxzZSwiZHVtcGZNUDQiOmZhbHNlLCJsZXZlbENhcHBpbmciOi0xLCJsaW1pdE1ldHJpY3MiOi0xfQ==))
|
||||
- CEA-608/708 captions
|
||||
- WebVTT subtitles
|
||||
- Alternate Audio Track Rendition (Master Playlist with Alternative Audio) for VoD and Live playlists
|
||||
- Adaptive streaming
|
||||
- Manual & Auto Quality Switching
|
||||
- 3 Quality Switching modes are available (controllable through API means)
|
||||
- Instant switching (immediate quality switch at current video position)
|
||||
- Smooth switching (quality switch for next loaded fragment)
|
||||
- Bandwidth conservative switching (quality switch change for next loaded fragment, without flushing the buffer)
|
||||
- In Auto-Quality mode, emergency switch down in case bandwidth is suddenly dropping to minimize buffering.
|
||||
- Accurate Seeking on VoD & Live (not limited to fragment or keyframe boundary)
|
||||
- Ability to seek in buffer and back buffer without redownloading segments
|
||||
- Built-in Analytics
|
||||
- All internal events can be monitored (Network Events, Video Events)
|
||||
- Playback session metrics are also exposed
|
||||
- Resilience to errors
|
||||
- Retry mechanism embedded in the library
|
||||
- Recovery actions can be triggered fix fatal media or network errors
|
||||
- [Redundant/Failover Playlists](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html#//apple_ref/doc/uid/TP40008332-CH102-SW22)
|
||||
|
||||
### Supported M3U8 tags
|
||||
|
||||
For details on the HLS format and these tags' meanings, see https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08
|
||||
|
||||
#### Manifest tags
|
||||
|
||||
- `#EXT-X-STREAM-INF:<attribute-list>`
|
||||
`<URI>`
|
||||
- `#EXT-X-MEDIA:<attribute-list>`
|
||||
- `#EXT-X-SESSION-DATA:<attribute-list>`
|
||||
|
||||
The following properties are added to their respective variants' attribute list but are not implemented in their selection and playback.
|
||||
|
||||
- `VIDEO-RANGE` and `HDCP-LEVEL` (See [#2489](https://github.com/video-dev/hls.js/issues/2489))
|
||||
|
||||
#### Playlist tags
|
||||
|
||||
- `#EXTM3U`
|
||||
- `#EXT-X-VERSION=<n>`
|
||||
- `#EXTINF:<duration>,[<title>]`
|
||||
- `#EXT-X-ENDLIST`
|
||||
- `#EXT-X-MEDIA-SEQUENCE=<n>`
|
||||
- `#EXT-X-TARGETDURATION=<n>`
|
||||
- `#EXT-X-DISCONTINUITY`
|
||||
- `#EXT-X-DISCONTINUITY-SEQUENCE=<n>`
|
||||
- `#EXT-X-BYTERANGE=<n>[@<o>]`
|
||||
- `#EXT-X-MAP:<attribute-list>`
|
||||
- `#EXT-X-KEY:<attribute-list>` (`METHOD=SAMPLE-AES` is only supports with MPEG-2 TS segments)
|
||||
- `#EXT-X-PROGRAM-DATE-TIME:<attribute-list>`
|
||||
- `#EXT-X-START:TIME-OFFSET=<n>`
|
||||
- `#EXT-X-SERVER-CONTROL:<attribute-list>`
|
||||
- `#EXT-X-PART-INF:PART-TARGET=<n>`
|
||||
- `#EXT-X-PART:<attribute-list>`
|
||||
- `#EXT-X-PRELOAD-HINT:<attribute-list>`
|
||||
- `#EXT-X-SKIP:<attribute-list>`
|
||||
- `#EXT-X-RENDITION-REPORT:<attribute-list>`
|
||||
|
||||
The following tags are added to their respective fragment's attribute list but are not implemented in streaming and playback.
|
||||
|
||||
- `#EXT-X-DATERANGE:<attribute-list>` (Not added to metadata TextTracks. See [#2218](https://github.com/video-dev/hls.js/issues/2218))
|
||||
- `#EXT-X-BITRATE` (Not used in ABR controller)
|
||||
- `#EXT-X-GAP` (Not implemented. See [#2940](https://github.com/video-dev/hls.js/issues/2940))
|
||||
|
||||
### Not Supported
|
||||
|
||||
For a complete list of issues, see ["Top priorities" in the Release Planning and Backlog project tab](https://github.com/video-dev/hls.js/projects/6). Codec support is dependent on the runtime environment (for example, not all browsers on the same OS support HEVC).
|
||||
|
||||
- CMAF CC support [#2623](https://github.com/video-dev/hls.js/issues/2623)
|
||||
- `Emsg` Inband Timed Metadata for FMP4 (ID3 within Emsgv1) in "metadata" TextTracks [#2360](https://github.com/video-dev/hls.js/issues/2360)
|
||||
- `#EXT-X-DATERANGE` in "metadata" TextTracks [#2218](https://github.com/video-dev/hls.js/issues/2218)
|
||||
- `#EXT-X-GAP` filling [#2940](https://github.com/video-dev/hls.js/issues/2940)
|
||||
- `#EXT-X-I-FRAME-STREAM-INF` I-frame Media Playlist files
|
||||
- `SAMPLE-AES` with fmp4, aac, mp3, vtt... segments (MPEG-2 TS only)
|
||||
- PlayReady and FairPlay DRM ( See [#3779](https://github.com/video-dev/hls.js/issues/2360) and [issues labeled DRM](https://github.com/video-dev/hls.js/issues?q=is%3Aissue+is%3Aopen+label%3ADRM))
|
||||
- Advanced variant selection based on runtime media capabilities (See issues labeled [`media-capabilities`](https://github.com/video-dev/hls.js/labels/media-capabilities))
|
||||
- MP3 elementary stream audio in IE and Edge (<=18) on Windows 10 (See [#1641](https://github.com/video-dev/hls.js/issues/1641) and [Microsoft answers forum](https://answers.microsoft.com/en-us/ie/forum/all/ie11-on-windows-10-cannot-play-hls-with-mp3/2da994b5-8dec-4ae9-9201-7d138ede49d9))
|
||||
|
||||
### Server-side-rendering (SSR) and `require` from a Node.js runtime
|
||||
|
||||
You can safely require this library in Node and **absolutely nothing will happen**. A dummy object is exported so that requiring the library does not throw an error. HLS.js is not instantiable in Node.js. See [#1841](https://github.com/video-dev/hls.js/pull/1841) for more details.
|
||||
|
||||
## Getting started with development
|
||||
|
||||
First, checkout the repository and install the required dependencies
|
||||
|
||||
```sh
|
||||
git clone https://github.com/video-dev/hls.js.git
|
||||
cd hls.js
|
||||
# After cloning or pulling from the repository, make sure all dependencies are up-to-date
|
||||
npm install ci
|
||||
# Run dev-server for demo page (recompiles on file-watch, but doesn't write to actual dist fs artifacts)
|
||||
npm run dev
|
||||
# After making changes run the sanity-check task to verify all checks before committing changes
|
||||
npm run sanity-check
|
||||
```
|
||||
|
||||
The dev server will host files on port 8000. Once started, the demo can be found running at http://localhost:8000/demo/.
|
||||
|
||||
Before submitting a PR, please see our [contribution guidelines](CONTRIBUTING.md).
|
||||
Join the discussion on Slack via [video-dev.org](https://video-dev.org) in #hlsjs for updates and questions about development.
|
||||
|
||||
### Build tasks
|
||||
|
||||
Build all flavors (suitable for prod-mode/CI):
|
||||
|
||||
```
|
||||
npm install ci
|
||||
npm run build
|
||||
```
|
||||
|
||||
Only debug-mode artifacts:
|
||||
|
||||
```
|
||||
npm run build:debug
|
||||
```
|
||||
|
||||
Build and watch (customized dev setups where you'll want to host through another server than webpacks' - for example in a sub-module/project)
|
||||
|
||||
```
|
||||
npm run build:watch
|
||||
```
|
||||
|
||||
Only specific flavor (known configs are: debug, dist, light, light-dist, demo):
|
||||
|
||||
```
|
||||
npm run build -- --env dist # replace "dist" by other configuration name, see above ^
|
||||
```
|
||||
|
||||
Note: The "demo" config is always built.
|
||||
|
||||
**NOTE:** `hls.light.*.js` dist files do not include EME, subtitles, CMCD, or alternate-audio support. In addition,
|
||||
the following types are not available in the light build:
|
||||
|
||||
- `AudioStreamController`
|
||||
- `AudioTrackController`
|
||||
- `CuesInterface`
|
||||
- `EMEController`
|
||||
- `SubtitleStreamController`
|
||||
- `SubtitleTrackController`
|
||||
- `TimelineController`
|
||||
- `CmcdController`
|
||||
|
||||
### Linter (ESlint)
|
||||
|
||||
Run linter:
|
||||
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
Run linter with auto-fix mode:
|
||||
|
||||
```
|
||||
npm run lint:fix
|
||||
```
|
||||
|
||||
Run linter with errors only (no warnings)
|
||||
|
||||
```
|
||||
npm run lint:quiet
|
||||
```
|
||||
|
||||
### Formatting Code
|
||||
|
||||
Run prettier to format code
|
||||
|
||||
```
|
||||
npm run prettier
|
||||
```
|
||||
|
||||
### Type Check
|
||||
|
||||
Run type-check to verify TypeScript types
|
||||
|
||||
```
|
||||
npm run type-check
|
||||
```
|
||||
|
||||
### Automated tests (Mocha/Karma)
|
||||
|
||||
Run all tests at once:
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
Run unit tests:
|
||||
|
||||
```
|
||||
npm run test:unit
|
||||
```
|
||||
|
||||
Run unit tests in watch mode:
|
||||
|
||||
```
|
||||
npm run test:unit:watch
|
||||
```
|
||||
|
||||
Run functional (integration) tests:
|
||||
|
||||
```
|
||||
npm run test:func
|
||||
```
|
||||
|
||||
## Design
|
||||
|
||||
An overview of this project's design, it's modules, events, and error handling can be found [here](/docs/design.md).
|
||||
|
||||
## API docs and usage guide
|
||||
|
||||
- [API and usage docs, with code examples](./docs/API.md)
|
||||
- [Auto-Generated API Docs (Latest Release)](https://hls-js.netlify.com/api-docs)
|
||||
- [Auto-Generated API Docs (Development Branch)](https://hls-js-dev.netlify.com/api-docs)
|
||||
|
||||
_Note you can access the docs for a particular version using "[https://github.com/video-dev/hls.js/tree/deployments](https://github.com/video-dev/hls.js/tree/deployments)"_
|
||||
|
||||
## Demo
|
||||
|
||||
### Latest Release
|
||||
|
||||
[https://hls-js.netlify.com/demo](https://hls-js.netlify.com/demo)
|
||||
|
||||
### Master
|
||||
|
||||
[https://hls-js-dev.netlify.com/demo](https://hls-js-dev.netlify.com/demo)
|
||||
|
||||
### Specific Version
|
||||
|
||||
Find the commit on [https://github.com/video-dev/hls.js/tree/deployments](https://github.com/video-dev/hls.js/tree/deployments).
|
||||
|
||||
[](https://www.netlify.com)
|
||||
|
||||
[](https://saucelabs.com)
|
||||
|
||||
## Compatibility
|
||||
|
||||
HLS.js is only compatible with browsers supporting MediaSource extensions (MSE) API with 'video/MP4' mime-type inputs.
|
||||
|
||||
HLS.js is supported on:
|
||||
|
||||
- Chrome 39+ for Android
|
||||
- Chrome 39+ for Desktop
|
||||
- Firefox 41+ for Android
|
||||
- Firefox 42+ for Desktop
|
||||
- IE11 for Windows 8.1+
|
||||
- Edge for Windows 10+
|
||||
- Safari 8+ for MacOS 10.10+
|
||||
- Safari for ipadOS 13+
|
||||
|
||||
A [Promise polyfill](https://github.com/taylorhakes/promise-polyfill) is required in browsers missing native promise support.
|
||||
|
||||
**Please note:** iOS Safari on iPhone does not support the MediaSource API. This includes all browsers on iOS as well as apps using UIWebView and WKWebView.
|
||||
|
||||
Safari browsers (iOS, iPadOS, and macOS) have built-in HLS support through the plain video "tag" source URL. See the example below (Using HLS.js) to run appropriate feature detection and choose between using HLS.js or natively built-in HLS support.
|
||||
|
||||
When a platform has neither MediaSource nor native HLS support, the browser cannot play HLS.
|
||||
|
||||
_Keep in mind that if the intention is to support HLS on multiple platforms, beyond those compatible with HLS.js, the HLS streams need to strictly follow the specifications of RFC8216, especially if apps, smart TVs, and set-top boxes are to be supported._
|
||||
|
||||
Find a support matrix of the MediaSource API here: https://developer.mozilla.org/en-US/docs/Web/API/MediaSource
|
||||
|
||||
## Using HLS.js
|
||||
|
||||
### Installation
|
||||
|
||||
Prepackaged builds are included [with each release](https://github.com/video-dev/hls.js/releases). Or install the hls.js as a dependency
|
||||
of your project:
|
||||
|
||||
```sh
|
||||
npm install --save hls.js
|
||||
```
|
||||
|
||||
A canary channel is also available if you prefer to work off the development branch (master):
|
||||
|
||||
```
|
||||
npm install hls.js@canary
|
||||
```
|
||||
|
||||
### Embedding HLS.js
|
||||
|
||||
Directly include dist/hls.js or dist/hls.min.js in a script tag on the page. This setup prioritizes HLS.js MSE playback over
|
||||
native browser support for HLS playback in HTMLMediaElements:
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||
<!-- Or if you want a more recent alpha version -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@alpha"></script> -->
|
||||
<video id="video"></video>
|
||||
<script>
|
||||
var video = document.getElementById('video');
|
||||
var videoSrc = 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8';
|
||||
if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(videoSrc);
|
||||
hls.attachMedia(video);
|
||||
}
|
||||
// HLS.js is not supported on platforms that do not have Media Source
|
||||
// Extensions (MSE) enabled.
|
||||
//
|
||||
// When the browser has built-in HLS support (check using `canPlayType`),
|
||||
// we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video
|
||||
// element through the `src` property. This is using the built-in support
|
||||
// of the plain video element, without using HLS.js.
|
||||
//
|
||||
// Note: it would be more normal to wait on the 'canplay' event below however
|
||||
// on Safari (where you are most likely to find built-in HLS support) the
|
||||
// video.src URL must be on the user-driven white-list before a 'canplay'
|
||||
// event will be emitted; the last video event that can be reliably
|
||||
// listened-for when the URL is not on the white-list is 'loadedmetadata'.
|
||||
else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = videoSrc;
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
#### Alternative setup
|
||||
|
||||
To check for native browser support first and then fallback to HLS.js, swap these conditionals. See [this comment](https://github.com/video-dev/hls.js/pull/2954#issuecomment-670021358) to understand some of the tradeoffs.
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||
<!-- Or if you want a more recent alpha version -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/hls.js@alpha"></script> -->
|
||||
<video id="video"></video>
|
||||
<script>
|
||||
var video = document.getElementById('video');
|
||||
var videoSrc = 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8';
|
||||
//
|
||||
// First check for native browser HLS support
|
||||
//
|
||||
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = videoSrc;
|
||||
//
|
||||
// If no native HLS support, check if HLS.js is supported
|
||||
//
|
||||
} else if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(videoSrc);
|
||||
hls.attachMedia(video);
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
For more embed and API examples see [docs/API.md](./docs/API.md).
|
||||
|
||||
## CORS
|
||||
|
||||
All HLS resources must be delivered with [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) permitting `GET` requests.
|
||||
|
||||
## Video Control
|
||||
|
||||
Video is controlled through HTML `<video>` element `HTMLVideoElement` methods, events and optional UI controls (`<video controls>`).
|
||||
|
||||
## Player Integration
|
||||
|
||||
The following players integrate HLS.js for HLS playback:
|
||||
|
||||
- [JW Player](https://www.jwplayer.com)
|
||||
- [Akamai Adaptive Media Player (AMP)](https://www.akamai.com/us/en/solutions/products/media-delivery/adaptive-media-player.jsp)
|
||||
- [Clappr](https://github.com/clappr/clappr)
|
||||
- [Flowplayer](https://www.flowplayer.org) through [flowplayer-hlsjs](https://github.com/flowplayer/flowplayer-hlsjs)
|
||||
- [MediaElement.js](https://www.mediaelementjs.com)
|
||||
- [Videojs](https://videojs.com) through [Videojs-hlsjs](https://github.com/benjipott/videojs-hlsjs)
|
||||
- [Videojs](https://videojs.com) through [videojs-hls.js](https://github.com/streamroot/videojs-hls.js). hls.js is integrated as a SourceHandler -- new feature in Video.js 5.
|
||||
- [Videojs](https://videojs.com) through [videojs-contrib-hls.js](https://github.com/Peer5/videojs-contrib-hls.js). Production ready plug-in with full fallback compatibility built-in.
|
||||
- [Fluid Player](https://www.fluidplayer.com)
|
||||
- [OpenPlayerJS](https://www.openplayerjs.com), as part of the [OpenPlayer project](https://github.com/openplayerjs)
|
||||
- [CDNBye](https://github.com/cdnbye/hlsjs-p2p-engine), a p2p engine for hls.js powered by WebRTC Datachannel.
|
||||
|
||||
### They use HLS.js in production!
|
||||
|
||||
| | | | |
|
||||
| :----------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
||||
| [<img src="https://i.cdn.turner.com/adultswim/big/img/global/adultswim.jpg" width="120">](https://www.adultswim.com/streams) | [<img src="https://avatars3.githubusercontent.com/u/5497190?s=200&v=4" width="120">](https://www.akamai.com) | [<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Canal%2B.svg/2000px-Canal%2B.svg.png" width="120">](https://www.canalplus.fr) | [<img src="https://avatars2.githubusercontent.com/u/115313" width="120">](https://www.dailymotion.com) |
|
||||
| [<img src="https://user-images.githubusercontent.com/4006693/44003595-baff193c-9e8f-11e8-9848-7bb91563499f.png" width="120">](https://freshlive.tv) | [<img src="https://flowplayer.org/media/img/logo-blue.png" width="120">](https://flowplayer.com) | [<img src="https://avatars1.githubusercontent.com/u/12554082?s=240" width="120">](https://www.foxsports.com.au) | [<img src="https://cloud.githubusercontent.com/assets/244265/12556435/dfaceb48-c353-11e5-971b-2c4429725469.png" width="120">](https://www.globo.com) |
|
||||
| [<img src="https://images.gunosy.com/logo/gunosy_icon_company_logo.png" width="120">](https://gunosy.com) | [<img src="https://user-images.githubusercontent.com/1480052/35802840-f8e85b8a-0a71-11e8-8eb2-eee323e3f159.png" width="120">](https://www.gl-systemhaus.de/) | [<img src="https://cloud.githubusercontent.com/assets/6525783/20801836/700490de-b7ea-11e6-82bd-e249f91c7bae.jpg" width="120">](https://nettrek.de) | [<img src="https://cloud.githubusercontent.com/assets/244265/12556385/999aa884-c353-11e5-9102-79df54384498.png" width="120">](https://www.nytimes.com/) |
|
||||
| [<img src="https://cloud.githubusercontent.com/assets/1798553/20356424/ba158574-ac24-11e6-95e1-1ae591b11a0a.png" width="120">](https://www.peer5.com/) | [<img src="https://cloud.githubusercontent.com/assets/4909096/20925062/e26e6fc8-bbb4-11e6-99a5-d4762274a342.png" width="120">](https://www.qbrick.com) | [<img src="https://www.radiantmediaplayer.com/images/radiantmediaplayer-new-logo-640.jpg" width="120">](https://www.radiantmediaplayer.com/) | [<img src="https://www.rts.ch/hummingbird-static/images/logos/logo_marts.svg" width="120">](https://www.rts.ch) |
|
||||
| [<img src="https://cloud.githubusercontent.com/assets/12702747/19316434/0a3601de-9067-11e6-85e2-936b1cb099a0.png" width="120">](https://www.snapstream.com/) | [<img src="https://pamediagroup.com/wp-content/uploads/2019/05/StreamAMG-Logo-RGB.png" width="120">](https://www.streamamg.com/) | [<img src="https://streamsharkio.sa.metacdn.com/wp-content/uploads/2015/10/streamshark-dark.svg" width="120">](https://streamshark.io/) | [<img src="https://camo.githubusercontent.com/9580f10e9bfa8aa7fba52c5cb447bee0757e33da/68747470733a2f2f7777772e7461626c6f74762e636f6d2f7374617469632f696d616765732f7461626c6f5f6c6f676f2e706e67" width="120">](https://my.tablotv.com/) |
|
||||
| [<img src="https://user-images.githubusercontent.com/2803310/34083705-349c8fd0-e375-11e7-92a6-5c38509f4936.png" width="120">](https://www.streamroot.io/) | [<img src="https://vignette1.wikia.nocookie.net/tedtalks/images/c/c0/TED_logo.png/revision/20150915192527" width="120">](https://www.ted.com/) | [<img src="https://www.seeklogo.net/wp-content/uploads/2014/12/twitter-logo-vector-download.jpg" width="120">](https://twitter.com/) | [<img src="https://player.clevercast.com/img/clevercast.png" width="120">](https://www.clevercast.com) |
|
||||
| [<img src="https://player.mtvnservices.com/edge/hosted/Viacom_logo.svg" width="120">](https://www.viacom.com/) | [<img src="https://user-images.githubusercontent.com/1181974/29248959-efabc440-802d-11e7-8050-7c1f4ca6c607.png" width="120">](https://vk.com/) | [<img src="https://avatars0.githubusercontent.com/u/5090060?s=200&v=4" width="120">](https://www.jwplayer.com) | [<img src="https://staticftv-a.akamaihd.net/arches/francetv/default/img/og-image.jpg?20161007" width="120">](https://www.france.tv) |
|
||||
| [<img src="https://showmax.akamaized.net/e/logo/showmax_black.png" width="120">](https://tech.showmax.com) | [<img src="https://static3.1tv.ru/assets/web/logo-ac67852f1625b338f9d1fb96be089d03557d50bfc5790d5f48dc56799f59dec6.svg" width="120" height="120">](https://www.1tv.ru/) | [<img src="https://user-images.githubusercontent.com/1480052/40482633-c013ebce-5f55-11e8-96d5-b776415de0ce.png" width="120">](https://www.zdf.de) | [<img src="https://github.com/cdnbye/hlsjs-p2p-engine/blob/master/figs/cdnbye.png" width="120">](https://github.com/cdnbye/hlsjs-p2p-engine) |
|
||||
| [cdn77](https://streaming.cdn77.com/) | [<img src="https://avatars0.githubusercontent.com/u/7442371?s=200&v=4" width="120">](https://r7.com/) | [<img src="https://raw.githubusercontent.com/Novage/p2p-media-loader/gh-pages/images/p2pml-logo.png" width="120">](https://github.com/Novage/p2p-media-loader) | [<img src="https://avatars3.githubusercontent.com/u/45617200?s=400" width="120">](https://kayosports.com.au) |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/5279615?s=400&u=9771a216836c613f1edf4afe71cfc69d4c5657ed&v=4" width="120">](https://flosports.tv) | [<img src="https://www.logolynx.com/images/logolynx/c6/c67a2cb3ad33a82b5518f8ad8f124703.png" width="120">](https://global.axon.com/) | | |
|
||||
|
||||
## Chrome/Firefox integration
|
||||
|
||||
made by [gramk](https://github.com/gramk/chrome-hls), plays hls from address bar and m3u8 links
|
||||
|
||||
- Chrome [native-hls](https://chrome.google.com/webstore/detail/native-hls-playback/emnphkkblegpebimobpbekeedfgemhof)
|
||||
- Firefox [native-hls](https://addons.mozilla.org/en-US/firefox/addon/native_hls_playback/)
|
||||
|
||||
## License
|
||||
|
||||
HLS.js is released under [Apache 2.0 License](LICENSE)
|
42195
public/ckplayer/hls.js/hls-demo.js
Normal file
1
public/ckplayer/hls.js/hls-demo.js.map
Normal file
27804
public/ckplayer/hls.js/hls.js
Normal file
2837
public/ckplayer/hls.js/hls.js.d.ts
vendored
Normal file
1
public/ckplayer/hls.js/hls.js.map
Normal file
20929
public/ckplayer/hls.js/hls.light.js
Normal file
1
public/ckplayer/hls.js/hls.light.js.map
Normal file
2
public/ckplayer/hls.js/hls.light.min.js
vendored
Normal file
1
public/ckplayer/hls.js/hls.light.min.js.map
Normal file
2
public/ckplayer/hls.js/hls.min.js
vendored
Normal file
1
public/ckplayer/hls.js/hls.min.js.map
Normal file
7421
public/ckplayer/js/ckplayer.js
Normal file
7
public/ckplayer/js/ckplayer.min.js
vendored
Normal file
72
public/ckplayer/language/en.js
Normal file
@ -0,0 +1,72 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.ckplayerLanguage = factory());
|
||||
}(this, function () { 'use strict';
|
||||
/*
|
||||
* 功能:包含播放器用到的全部相关语言文字
|
||||
*/
|
||||
var language={
|
||||
play:'Play',
|
||||
pause:'Pause',
|
||||
refresh:'Refresh',
|
||||
full:'Fullscreen',
|
||||
exitFull:'Non-Fullscreen',
|
||||
webFull:'Web fullscreen',
|
||||
exitWebFull:'Non-Web fullscreen',
|
||||
theatre:'Theatre',
|
||||
exitTheatre:'Non-theatre',
|
||||
volume:'Volume:',
|
||||
muted:'Mute',
|
||||
exitmuted:'Unmute',
|
||||
seek:'Seek:',
|
||||
waiting:'Waiting',
|
||||
live:'Liveing',
|
||||
backLive:'Back live',
|
||||
lookBack:'Look back:',
|
||||
next:'Next episode',
|
||||
screenshot:'Screenshot',
|
||||
smallwindows:'Small windows',
|
||||
playbackrate:'Speed',
|
||||
playbackrateSuffix:' Speed',
|
||||
track:'Subtitle',
|
||||
noTrack:'No subtitle',
|
||||
definition:'Definition',
|
||||
switchTo:'Switched from:',
|
||||
closeTime:'The advertisement can be closed in {seconds} seconds',
|
||||
closeAd:'Close ad',
|
||||
second:'seconds',
|
||||
details:'View details',
|
||||
copy:'Copy',
|
||||
copySucceeded:'Copy succeeded, can be pasted!',
|
||||
smallwindowsOpen:'The small window function is turned on',
|
||||
screenshotStart:'Screenshot, please wait...',
|
||||
smallwindowsClose:'The small window function is turned off',
|
||||
screenshotClose:'Screenshot function is turned off',
|
||||
loopOpen:'Loop open',
|
||||
loopClose:'Loop close',
|
||||
close:'Close',
|
||||
down:'Down',
|
||||
p50:'50%',
|
||||
p75:'75%',
|
||||
p100:'100%',
|
||||
timeScheduleAdjust:{
|
||||
prohibit:'No dragging',
|
||||
prohibitBackOff:'No repeat viewing',
|
||||
prohibitForward:'Fast forward prohibited',
|
||||
prohibitLookBack:'Some content is forbidden to play',
|
||||
prohibitForwardNotViewed:'Disable playback of parts not viewed'
|
||||
},
|
||||
error:{
|
||||
noMessage:'Unknown error',
|
||||
supportVideoError:'The browser version is too low. It is recommended to replace it with another browser',
|
||||
videoTypeError:'This browser does not support playing this video. It is recommended to replace it with another browser',
|
||||
loadingFailed:'Loading failed',
|
||||
emptied:'An error occurred while loading the frequency file',
|
||||
screenshot:'Screenshot failed',
|
||||
ajax:'Ajax data request error',
|
||||
noVideoContainer:'No video container'
|
||||
}
|
||||
};
|
||||
return language;
|
||||
}))
|
72
public/ckplayer/language/zh.cn.js
Normal file
@ -0,0 +1,72 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.ckplayerLanguage = factory());
|
||||
}(this, function () { 'use strict';
|
||||
/*
|
||||
* 功能:包含播放器用到的全部相关语言文字
|
||||
*/
|
||||
var language={
|
||||
play:'播放',
|
||||
pause:'暂停',
|
||||
refresh:'重播',
|
||||
full:'全屏',
|
||||
exitFull:'退出全屏',
|
||||
webFull:'页面全屏',
|
||||
exitWebFull:'退出页面全屏',
|
||||
theatre:'剧场模式',
|
||||
exitTheatre:'退出剧场模式',
|
||||
volume:'音量:',
|
||||
muted:'静音',
|
||||
exitmuted:'恢复音量',
|
||||
seek:'seek:',
|
||||
waiting:'缓冲',
|
||||
live:'直播中',
|
||||
backLive:'返回直播',
|
||||
lookBack:'回看:',
|
||||
next:'下一集',
|
||||
screenshot:'视频截图',
|
||||
smallwindows:'小窗口播放功能',
|
||||
playbackrate:'倍速',
|
||||
playbackrateSuffix:'倍',
|
||||
track:'字幕',
|
||||
noTrack:'无字幕',
|
||||
definition:'清晰度',
|
||||
switchTo:'切换成:',
|
||||
closeTime:'{seconds}秒后可关闭广告',
|
||||
closeAd:'关闭广告',
|
||||
second:'秒',
|
||||
details:'查看详情',
|
||||
copy:'复制',
|
||||
copySucceeded:'复制成功,可贴粘!',
|
||||
smallwindowsOpen:'小窗口功能已开启',
|
||||
smallwindowsClose:'小窗口功能已关闭',
|
||||
screenshotStart:'截图中,请稍候...',
|
||||
screenshotClose:'截图功能已关闭',
|
||||
loopOpen:'循环播放',
|
||||
loopClose:'已关闭循环播放',
|
||||
close:'关闭',
|
||||
down:'下载',
|
||||
p50:'50%',
|
||||
p75:'75%',
|
||||
p100:'100%',
|
||||
timeScheduleAdjust:{
|
||||
prohibit:'视频禁止拖动',
|
||||
prohibitBackOff:'视频禁止重复观看',
|
||||
prohibitForward:'视频禁止快进',
|
||||
prohibitLookBack:'视频禁止播放部分内容',
|
||||
prohibitForwardNotViewed:'视频禁止播放未观看的部分'
|
||||
},
|
||||
error:{
|
||||
noMessage:'未知错误',
|
||||
supportVideoError:'该浏览器版本太低,建议更换成其它浏览器',
|
||||
videoTypeError:'该浏览器不支持播放该视频,建议更换成其它浏览器',
|
||||
loadingFailed:'加载失败',
|
||||
emptied:'视频文件加载过程中出现错误',
|
||||
screenshot:'视频截图失败',
|
||||
ajax:'Ajax数据请求错误',
|
||||
noVideoContainer:'未找到放置视频的容器'
|
||||
}
|
||||
};
|
||||
return language;
|
||||
}))
|
72
public/ckplayer/language/zh.hk.js
Normal file
@ -0,0 +1,72 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.ckplayerLanguage = factory());
|
||||
}(this, function () { 'use strict';
|
||||
/*
|
||||
*功能:包含播放機用到的全部相關語言文字
|
||||
*/
|
||||
var language = {
|
||||
play: '播放',
|
||||
pause: '暫停',
|
||||
refresh: '重播',
|
||||
full: '全屏',
|
||||
exitFull: '退出全屏',
|
||||
webFull: '頁面全屏',
|
||||
exitWebFull: '退出頁面全屏',
|
||||
theatre: '劇場模式',
|
||||
exitTheatre: '退出劇場模式',
|
||||
volume: '音量:',
|
||||
muted: '靜音',
|
||||
exitmuted: '恢復音量',
|
||||
seek: 'seek:',
|
||||
waiting: '緩衝',
|
||||
live: '直播中',
|
||||
backLive: '返回直播',
|
||||
lookBack: '回看:',
|
||||
next: '下一集',
|
||||
screenshot: '視頻截圖',
|
||||
smallwindows: '小視窗播放功能',
|
||||
playbackrate: '倍速',
|
||||
playbackrateSuffix: '倍',
|
||||
track: '字幕',
|
||||
noTrack: '無字幕',
|
||||
definition: '清晰度',
|
||||
switchTo: '切換成:',
|
||||
closeTime: '{seconds}秒後可關閉廣告',
|
||||
closeAd: '關閉廣告',
|
||||
second: '秒',
|
||||
details: '查看詳情',
|
||||
copy: '複製',
|
||||
copySucceeded: '複製成功,可貼粘!',
|
||||
smallwindowsOpen: '小視窗功能已開啟',
|
||||
smallwindowsClose: '小視窗功能已關閉',
|
||||
screenshotStart: '截圖中,請稍候…',
|
||||
screenshotClose: '截圖功能已關閉',
|
||||
loopOpen: '迴圈播放',
|
||||
loopClose: '已關閉迴圈播放',
|
||||
close: '關閉',
|
||||
down: '下載',
|
||||
p50: '50%',
|
||||
p75: '75%',
|
||||
p100: '100%',
|
||||
timeScheduleAdjust: {
|
||||
prohibit: '視頻禁止拖動',
|
||||
prohibitBackOff: '視頻禁止重複觀看',
|
||||
prohibitForward: '視頻禁止快進',
|
||||
prohibitLookBack: '視頻禁止播放部分內容',
|
||||
prohibitForwardNotViewed: '視頻禁止播放未觀看的部分'
|
||||
},
|
||||
error: {
|
||||
noMessage: '未知錯誤',
|
||||
supportVideoError: '該流覽器版本太低,建議更換成其它瀏覽器',
|
||||
videoTypeError: '該瀏覽器不支持播放該視頻,建議更換成其它瀏覽器',
|
||||
loadingFailed: '加載失敗',
|
||||
emptied: '視頻檔案加載過程中出現錯誤',
|
||||
screenshot: '視頻截圖失敗',
|
||||
ajax: 'Ajax數據請求錯誤',
|
||||
noVideoContainer: '未找到放置視頻的容器'
|
||||
}
|
||||
};
|
||||
return language;
|
||||
}))
|
202
public/ckplayer/mpegts.js/LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
9
public/ckplayer/mpegts.js/mpegts.js
Normal file
1
public/ckplayer/mpegts.js/mpegts.js.map
Normal file
9
public/ckplayer/mpegts.js/mpegts.min.js
vendored
Normal file
BIN
public/images/course/courseAi.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
public/images/course/courseAii.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
@ -96,9 +96,9 @@ export class CourseApi {
|
||||
}
|
||||
}
|
||||
// 获取课程列表 - 适配后端接口
|
||||
static async getCourses(params?: CourseListQueryParams): Promise<ApiResponse<Course[]>> {
|
||||
static async getCourses(params?: CourseListQueryParams, includeUserData: boolean = false): Promise<ApiResponse<Course[]>> {
|
||||
try {
|
||||
console.log('🚀 调用课程列表API,参数:', params)
|
||||
console.log('🚀 调用课程列表API,参数:', params, '包含用户数据:', includeUserData)
|
||||
|
||||
// 构建查询参数,根据API文档的参数名称
|
||||
const queryParams: any = {}
|
||||
@ -108,8 +108,19 @@ export class CourseApi {
|
||||
|
||||
console.log('🔍 查询参数:', queryParams)
|
||||
|
||||
// 调用后端API
|
||||
const response = await ApiRequest.get<any>('/aiol/aiolCourse/query_list', queryParams)
|
||||
// 根据是否需要用户数据决定API调用方式
|
||||
let response: any
|
||||
if (includeUserData) {
|
||||
// 登录状态下,会自动带token
|
||||
response = await ApiRequest.get<any>('/aiol/aiolCourse/query_list', queryParams)
|
||||
} else {
|
||||
// 未登录状态下,不带token
|
||||
response = await ApiRequest.get<any>('/aiol/aiolCourse/query_list', queryParams, {
|
||||
headers: {
|
||||
'X-Access-Token': '' // 明确不传token
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log('🔍 课程列表API响应:', response)
|
||||
|
||||
// 处理后端响应格式
|
||||
@ -130,7 +141,7 @@ export class CourseApi {
|
||||
studentsCount: item.enrollCount || 0,
|
||||
lessonsCount: 0, // 后端没有课程数量字段,设为0
|
||||
tags: [],
|
||||
isEnrolled: false,
|
||||
isEnrolled: item.isEnrolled || false,
|
||||
progress: 0,
|
||||
createdAt: this.formatTimestamp(item.createTime),
|
||||
updatedAt: this.formatTimestamp(item.updateTime),
|
||||
@ -798,6 +809,36 @@ export class CourseApi {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取章节作业
|
||||
static async getSectionHomework(courseId: string, sectionId: string): Promise<ApiResponse<any>> {
|
||||
try {
|
||||
console.log('🚀 调用章节作业API,课程ID:', courseId, '章节ID:', sectionId)
|
||||
|
||||
const response = await ApiRequest.get<any>(`/aiol/aiolCourse/${courseId}/section_homework/${sectionId}`)
|
||||
console.log('🔍 章节作业API响应:', response)
|
||||
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('❌ 获取章节作业失败:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
// 获取章节资料
|
||||
static async getSectionDocument(courseId: string, sectionId: string): Promise<ApiResponse<any>> {
|
||||
try {
|
||||
console.log('🚀 调用章节资料API,课程ID:', courseId, '章节ID:', sectionId)
|
||||
|
||||
const response = await ApiRequest.get<any>(`/aiol/aiolCourse/${courseId}/section_document/${sectionId}`)
|
||||
console.log('🔍 章节资料API响应:', response)
|
||||
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('❌ 获取章节资料失败:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
// 更新学习进度
|
||||
static updateLearningProgress(data: {
|
||||
courseId: number
|
||||
|
@ -95,7 +95,7 @@ export class ExamApi {
|
||||
*/
|
||||
static async updateRepo(data: UpdateRepoRequest): Promise<ApiResponse<string>> {
|
||||
console.log('🚀 编辑题库:', data)
|
||||
const response = await ApiRequest.put<string>('/gen/repo/repo/edit', data)
|
||||
const response = await ApiRequest.put<string>('/aiol/aiolRepo/edit', data)
|
||||
console.log('✅ 编辑题库成功:', response)
|
||||
return response
|
||||
}
|
||||
|
@ -320,6 +320,7 @@ export interface BackendCourseItem {
|
||||
status: number
|
||||
question: string
|
||||
izAi: number | null // AI伴学模式标识:1=AI伴学,0=普通模式,null=普通模式
|
||||
isEnrolled?: boolean // 是否已报名(仅在登录状态下返回)
|
||||
createBy: string
|
||||
createTime: string
|
||||
updateBy: string
|
||||
|
@ -85,17 +85,22 @@ watch(() => props.videoUrl, (newUrl) => {
|
||||
const loadHLSScript = (): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if ((window as any).Hls) {
|
||||
console.log('✅ HLS.js already loaded')
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
|
||||
console.log('🔄 Loading HLS.js...')
|
||||
const script = document.createElement('script')
|
||||
script.src = 'https://cdn.jsdelivr.net/npm/hls.js@1.4.14/dist/hls.min.js'
|
||||
script.src = 'https://cdn.jsdelivr.net/npm/hls.js@1.5.15/dist/hls.min.js'
|
||||
script.onload = () => {
|
||||
console.log('✅ HLS.js loaded')
|
||||
console.log('✅ HLS.js loaded successfully')
|
||||
console.log('🔍 HLS.js version:', (window as any).Hls?.version)
|
||||
console.log('🔍 HLS.js supported:', (window as any).Hls?.isSupported())
|
||||
resolve()
|
||||
}
|
||||
script.onerror = () => {
|
||||
console.error('❌ Failed to load HLS.js')
|
||||
script.onerror = (error) => {
|
||||
console.error('❌ Failed to load HLS.js:', error)
|
||||
reject(new Error('Failed to load HLS.js'))
|
||||
}
|
||||
document.head.appendChild(script)
|
||||
@ -161,33 +166,30 @@ const initDPlayer = async (url: string) => {
|
||||
|
||||
// HLS特殊处理
|
||||
if (isHLS && (window as any).Hls && (window as any).Hls.isSupported()) {
|
||||
// console.log('🔧 使用HLS.js')
|
||||
console.log('🔧 使用HLS.js播放HLS流:', url)
|
||||
options.video.type = 'hls'
|
||||
options.video.customType = {
|
||||
hls: function(video: HTMLVideoElement, _player: DPlayer) {
|
||||
// console.log('🎬 配置HLS.js')
|
||||
|
||||
console.log('🎬 配置HLS.js实例')
|
||||
|
||||
const hls = new (window as any).Hls({
|
||||
debug: false,
|
||||
enableWorker: false, // 禁用Worker避免兼容性问题
|
||||
enableWorker: true, // 启用Worker提高性能
|
||||
lowLatencyMode: false,
|
||||
// 缓冲区配置 - 减少bufferAppendError
|
||||
maxBufferLength: 20, // 减少最大缓冲长度
|
||||
maxMaxBufferLength: 40, // 减少绝对最大缓冲长度
|
||||
maxBufferSize: 30 * 1000 * 1000, // 30MB缓冲区大小
|
||||
maxBufferHole: 0.3, // 缓冲区空洞容忍度
|
||||
highBufferWatchdogPeriod: 1, // 高缓冲区监控周期
|
||||
nudgeOffset: 0.05, // 微调偏移
|
||||
nudgeMaxRetry: 2, // 最大微调重试次数
|
||||
// 简化的缓冲区配置
|
||||
maxBufferLength: 30,
|
||||
maxMaxBufferLength: 600,
|
||||
maxBufferSize: 60 * 1000 * 1000, // 60MB
|
||||
maxBufferHole: 0.5,
|
||||
// 网络配置
|
||||
fragLoadingTimeOut: 20000,
|
||||
fragLoadingMaxRetry: 3,
|
||||
fragLoadingMaxRetry: 4,
|
||||
manifestLoadingTimeOut: 10000,
|
||||
manifestLoadingMaxRetry: 2,
|
||||
// 启用渐进式加载
|
||||
progressive: false,
|
||||
// 减少并发请求
|
||||
maxLoadingDelay: 2
|
||||
manifestLoadingMaxRetry: 3,
|
||||
// CORS配置
|
||||
xhrSetup: function(xhr: XMLHttpRequest, _url: string) {
|
||||
xhr.withCredentials = false
|
||||
}
|
||||
})
|
||||
|
||||
hls.on((window as any).Hls.Events.MANIFEST_PARSED, () => {
|
||||
@ -267,10 +269,19 @@ const initDPlayer = async (url: string) => {
|
||||
;(video as any).hlsInstance = hls
|
||||
}
|
||||
}
|
||||
} else if (isHLS) {
|
||||
// HLS不支持时的回退处理
|
||||
console.log('⚠️ HLS.js不支持,尝试原生播放')
|
||||
options.video.type = 'auto'
|
||||
}
|
||||
|
||||
// 创建播放器
|
||||
// console.log('🔨 创建DPlayer实例...')
|
||||
console.log('🔨 创建DPlayer实例,配置:', {
|
||||
url: options.video.url,
|
||||
type: options.video.type,
|
||||
isHLS,
|
||||
hlsSupported: (window as any).Hls?.isSupported()
|
||||
})
|
||||
dplayer.value = new DPlayer(options)
|
||||
|
||||
// 绑定事件
|
||||
|
@ -578,6 +578,12 @@ const routes: RouteRecordRaw[] = [
|
||||
component: ActivityRegistration,
|
||||
meta: { title: '活动报名' }
|
||||
},
|
||||
{
|
||||
path: '/course/:courseId/practice/:sectionId',
|
||||
name: 'Practice',
|
||||
component: () => import('@/views/Practice.vue'),
|
||||
meta: { title: '练习作业', requiresAuth: true }
|
||||
},
|
||||
{
|
||||
path: '/course/:courseId/exam/:sectionId/notice',
|
||||
name: 'ExamNotice',
|
||||
|
@ -756,6 +756,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { CourseApi } from '@/api/modules/course'
|
||||
@ -768,6 +769,7 @@ import RegisterModal from '@/components/auth/RegisterModal.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const message = useMessage()
|
||||
const userStore = useUserStore()
|
||||
const courseId = ref(String(route.query.courseId) || '1')
|
||||
const { loginModalVisible, registerModalVisible, handleAuthSuccess, showLoginModal } = useAuth()
|
||||
@ -1579,23 +1581,36 @@ const confirmEnrollment = async () => {
|
||||
try {
|
||||
enrollmentLoading.value = true
|
||||
|
||||
// 模拟API调用
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
console.log('🚀 开始报名课程,课程ID:', courseId.value)
|
||||
|
||||
// 报名成功
|
||||
isEnrolled.value = true
|
||||
enrollConfirmVisible.value = false
|
||||
enrollSuccessVisible.value = true
|
||||
// 调用真实的报名API
|
||||
const response = await CourseApi.enrollCourse(courseId.value)
|
||||
console.log('📊 报名API响应:', response)
|
||||
|
||||
// 2秒后跳转到已兑换课程页面
|
||||
setTimeout(() => {
|
||||
enrollSuccessVisible.value = false
|
||||
// 跳转到已兑换课程页面
|
||||
router.push(`/course/${courseId.value}/exchanged`)
|
||||
}, 2000)
|
||||
if (response.code === 200 || response.code === 0) {
|
||||
console.log('✅ 报名成功:', response.data)
|
||||
|
||||
// 报名成功
|
||||
isEnrolled.value = true
|
||||
enrollConfirmVisible.value = false
|
||||
enrollSuccessVisible.value = true
|
||||
|
||||
// 2秒后跳转到已兑换课程页面
|
||||
setTimeout(() => {
|
||||
enrollSuccessVisible.value = false
|
||||
// 跳转到已兑换课程页面
|
||||
router.push(`/course/${courseId.value}/exchanged`)
|
||||
}, 2000)
|
||||
} else {
|
||||
console.error('❌ 报名失败:', response.message)
|
||||
message.error(response.message || '报名失败,请稍后重试')
|
||||
enrollConfirmVisible.value = false
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('报名失败:', error)
|
||||
console.error('❌ 报名失败:', error)
|
||||
message.error('报名失败,请稍后重试')
|
||||
enrollConfirmVisible.value = false
|
||||
} finally {
|
||||
enrollmentLoading.value = false
|
||||
}
|
||||
|
@ -1807,28 +1807,157 @@ const getLessonTypeBadgeClass = (section: CourseSection) => {
|
||||
}
|
||||
|
||||
// 处理下载操作
|
||||
const handleDownload = (section: CourseSection) => {
|
||||
console.log('下载资料:', section)
|
||||
// 这里可以实现下载逻辑
|
||||
alert(`下载资料: ${section.name}`)
|
||||
const handleDownload = async (section: CourseSection) => {
|
||||
console.log('📄 获取章节资料:', section)
|
||||
|
||||
try {
|
||||
// 调用章节资料API
|
||||
const response = await CourseApi.getSectionDocument(courseId.value, section.id.toString())
|
||||
|
||||
if (response.data && (response.data.code === 200 || response.data.code === 0)) {
|
||||
console.log('✅ 获取章节资料成功:', response.data)
|
||||
|
||||
const documents = response.data.result || []
|
||||
|
||||
if (documents.length === 0) {
|
||||
message.warning('该章节暂无资料')
|
||||
return
|
||||
}
|
||||
|
||||
// 处理所有资料文件
|
||||
documents.forEach((doc: any, index: number) => {
|
||||
if (doc.fileUrl) {
|
||||
setTimeout(() => {
|
||||
const fileName = doc.name || `${section.name}_资料${index + 1}`
|
||||
const fileExtension = getFileExtension(doc.fileUrl)
|
||||
|
||||
// 先在新标签页中打开预览
|
||||
openFilePreview(doc.fileUrl, fileName)
|
||||
|
||||
// 对于某些文件类型,自动下载到本地
|
||||
if (shouldAutoDownload(fileExtension)) {
|
||||
setTimeout(() => {
|
||||
downloadFile(doc.fileUrl, fileName)
|
||||
}, 1000) // 延迟1秒下载,让预览先打开
|
||||
}
|
||||
}, index * 500) // 延迟处理,避免浏览器阻止多个操作
|
||||
}
|
||||
})
|
||||
|
||||
const downloadableCount = documents.filter((doc: any) =>
|
||||
shouldAutoDownload(getFileExtension(doc.fileUrl))
|
||||
).length
|
||||
|
||||
if (downloadableCount > 0) {
|
||||
message.success(`正在打开预览并下载 ${downloadableCount} 个资料文件`)
|
||||
} else {
|
||||
message.success(`正在打开 ${documents.length} 个资料文件预览`)
|
||||
}
|
||||
} else {
|
||||
console.error('❌ 获取章节资料失败:', response.data?.message || response.message)
|
||||
message.error(response.data?.message || response.message || '获取资料失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 获取章节资料异常:', error)
|
||||
message.error('获取资料失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取文件扩展名
|
||||
const getFileExtension = (url: string): string => {
|
||||
try {
|
||||
const pathname = new URL(url).pathname
|
||||
const extension = pathname.split('.').pop()?.toLowerCase() || ''
|
||||
return extension
|
||||
} catch (error) {
|
||||
// 如果URL解析失败,尝试从字符串中提取
|
||||
const parts = url.split('.')
|
||||
return parts.length > 1 ? parts.pop()?.toLowerCase() || '' : ''
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否需要自动下载
|
||||
const shouldAutoDownload = (extension: string): boolean => {
|
||||
// 对于这些文件类型,自动下载到本地
|
||||
const downloadableTypes = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'zip', 'rar', '7z']
|
||||
return downloadableTypes.includes(extension)
|
||||
}
|
||||
|
||||
// 在新标签页中打开文件预览
|
||||
const openFilePreview = (url: string, filename: string) => {
|
||||
try {
|
||||
console.log('👁️ 打开文件预览:', filename, url)
|
||||
|
||||
// 在新标签页中打开文件
|
||||
window.open(url, '_blank')
|
||||
|
||||
console.log('✅ 文件预览已打开:', filename)
|
||||
} catch (error) {
|
||||
console.error('❌ 打开文件预览失败:', error)
|
||||
message.error(`打开文件预览失败: ${filename}`)
|
||||
}
|
||||
}
|
||||
|
||||
// 下载文件的辅助函数
|
||||
const downloadFile = (url: string, filename: string) => {
|
||||
try {
|
||||
console.log('📥 开始下载文件:', filename, url)
|
||||
|
||||
// 创建一个隐藏的a标签来触发下载
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = filename
|
||||
link.target = '_blank'
|
||||
link.style.display = 'none'
|
||||
|
||||
// 添加到DOM并点击
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
|
||||
// 清理
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(link)
|
||||
}, 100)
|
||||
|
||||
console.log('✅ 文件下载已触发:', filename)
|
||||
} catch (error) {
|
||||
console.error('❌ 下载文件失败:', error)
|
||||
message.error(`下载文件失败: ${filename}`)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理作业操作
|
||||
const handleHomework = (section: CourseSection) => {
|
||||
console.log('打开作业:', section)
|
||||
const handleHomework = async (section: CourseSection) => {
|
||||
console.log('📝 获取章节作业:', section)
|
||||
|
||||
// 跳转到练习页面
|
||||
router.push({
|
||||
name: 'Practice',
|
||||
params: {
|
||||
courseId: courseId.value,
|
||||
sectionId: section.id
|
||||
},
|
||||
query: {
|
||||
courseName: course.value?.title || '课程名称',
|
||||
practiceName: section.name
|
||||
try {
|
||||
// 调用章节作业API
|
||||
const response = await CourseApi.getSectionHomework(courseId.value, section.id.toString())
|
||||
|
||||
if (response.data && (response.data.code === 200 || response.data.code === 0)) {
|
||||
console.log('✅ 获取章节作业成功:', response.data)
|
||||
|
||||
// 跳转到练习页面
|
||||
router.push({
|
||||
name: 'Practice',
|
||||
params: {
|
||||
courseId: courseId.value,
|
||||
sectionId: section.id.toString()
|
||||
},
|
||||
query: {
|
||||
courseName: course.value?.title || '课程名称',
|
||||
practiceName: section.name,
|
||||
homeworkData: JSON.stringify(response.data.result)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.error('❌ 获取章节作业失败:', response.data?.message || response.message)
|
||||
message.error(response.data?.message || response.message || '获取作业失败')
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('❌ 获取章节作业异常:', error)
|
||||
message.error('获取作业失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 处理考试操作
|
||||
@ -1964,23 +2093,36 @@ const confirmEnrollment = async () => {
|
||||
try {
|
||||
enrollmentLoading.value = true
|
||||
|
||||
// 模拟API调用
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
console.log('🚀 开始报名课程,课程ID:', courseId.value)
|
||||
|
||||
// 报名成功
|
||||
isEnrolled.value = true
|
||||
enrollConfirmVisible.value = false
|
||||
enrollSuccessVisible.value = true
|
||||
// 调用真实的报名API
|
||||
const response = await CourseApi.enrollCourse(courseId.value)
|
||||
console.log('📊 报名API响应:', response)
|
||||
|
||||
// 2秒后跳转到已兑换课程页面
|
||||
setTimeout(() => {
|
||||
enrollSuccessVisible.value = false
|
||||
// 跳转到已兑换课程页面
|
||||
router.push(`/course/${courseId.value}/exchanged`)
|
||||
}, 2000)
|
||||
if (response.code === 200 || response.code === 0) {
|
||||
console.log('✅ 报名成功:', response.data)
|
||||
|
||||
// 报名成功
|
||||
isEnrolled.value = true
|
||||
enrollConfirmVisible.value = false
|
||||
enrollSuccessVisible.value = true
|
||||
|
||||
// 2秒后跳转到已兑换课程页面
|
||||
setTimeout(() => {
|
||||
enrollSuccessVisible.value = false
|
||||
// 跳转到已兑换课程页面
|
||||
router.push(`/course/${courseId.value}/exchanged`)
|
||||
}, 2000)
|
||||
} else {
|
||||
console.error('❌ 报名失败:', response.message)
|
||||
message.error(response.message || '报名失败,请稍后重试')
|
||||
enrollConfirmVisible.value = false
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('报名失败:', error)
|
||||
console.error('❌ 报名失败:', error)
|
||||
message.error('报名失败,请稍后重试')
|
||||
enrollConfirmVisible.value = false
|
||||
} finally {
|
||||
enrollmentLoading.value = false
|
||||
}
|
||||
|
@ -16,20 +16,23 @@
|
||||
|
||||
<!-- 视频播放器区域 -->
|
||||
<div class="video-player-section">
|
||||
<VideoPlayer
|
||||
<DPlayerVideo
|
||||
v-if="currentVideoUrl"
|
||||
:video-url="currentVideoUrl"
|
||||
:title="currentVideoTitle"
|
||||
:description="currentVideoDescription"
|
||||
:poster="videoPoster"
|
||||
:autoplay="autoplay"
|
||||
:show-controls="true"
|
||||
:placeholder="currentVideoUrl ? '正在加载视频...' : '请选择要播放的视频'"
|
||||
@play="onVideoPlay"
|
||||
@pause="onVideoPause"
|
||||
@ended="onVideoEnded"
|
||||
@timeupdate="onVideoTimeUpdate"
|
||||
@error="onVideoError"
|
||||
/>
|
||||
<div v-else class="video-placeholder">
|
||||
<div class="placeholder-content">
|
||||
<div class="play-icon">▶</div>
|
||||
<p>请选择要播放的视频</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 视频信息和控制 -->
|
||||
@ -362,7 +365,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import VideoPlayer from '@/components/VideoPlayer.vue'
|
||||
import DPlayerVideo from '@/components/DPlayerVideo.vue'
|
||||
import { CourseApi } from '@/api/modules/course'
|
||||
import type { Course, CourseSection } from '@/api/types'
|
||||
|
||||
@ -649,10 +652,6 @@ const onVideoEnded = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const onVideoTimeUpdate = (_time: number) => {
|
||||
// 记录学习时长
|
||||
totalStudyTime.value += 1
|
||||
}
|
||||
|
||||
const onVideoError = (error: Event) => {
|
||||
console.error('视频播放错误:', error)
|
||||
|
@ -113,7 +113,18 @@
|
||||
<div class="course-stats">
|
||||
<span class="course-students">讲师: {{ getCourseInstructors(course) }}</span>
|
||||
</div>
|
||||
<button class="enroll-btn" @click="goToCourseDetail(course)">去学习</button>
|
||||
<button
|
||||
:class="getButtonClass(course)"
|
||||
@click="goToCourseDetail(course)"
|
||||
>
|
||||
<img
|
||||
v-if="shouldShowButtonIcon(course)"
|
||||
:src="getButtonIcon(course)"
|
||||
alt="AI图标"
|
||||
class="button-icon"
|
||||
/>
|
||||
{{ getButtonText(course) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -223,6 +234,46 @@ const shouldShowAiTag = (course: any) => {
|
||||
return course?.izAi === 1
|
||||
}
|
||||
|
||||
// 获取按钮文本
|
||||
const getButtonText = (course: any) => {
|
||||
const isAi = course?.izAi === 1
|
||||
const isEnrolled = course?.isEnrolled === true
|
||||
|
||||
console.log('🔍 按钮文本逻辑:', {
|
||||
courseId: course?.id,
|
||||
courseName: course?.title || course?.name,
|
||||
isAi,
|
||||
isEnrolled,
|
||||
izAi: course?.izAi
|
||||
})
|
||||
|
||||
if (isAi) {
|
||||
// AI伴学模式:isEnrolled=true显示"去学习",isEnrolled=false显示"去报名"
|
||||
return isEnrolled ? '去学习' : '去报名'
|
||||
} else {
|
||||
// 普通模式:isEnrolled=true显示"去学习",isEnrolled=false显示"去报名"
|
||||
return isEnrolled ? '去学习' : '去报名'
|
||||
}
|
||||
}
|
||||
|
||||
// 获取按钮样式类
|
||||
const getButtonClass = (course: any) => {
|
||||
const isAi = course?.izAi === 1
|
||||
return isAi ? 'enroll-btn ai-btn' : 'enroll-btn'
|
||||
}
|
||||
|
||||
// 是否显示按钮图标
|
||||
const shouldShowButtonIcon = (course: any) => {
|
||||
return course?.izAi === 1
|
||||
}
|
||||
|
||||
// 获取按钮图标
|
||||
const getButtonIcon = (course: any) => {
|
||||
const isEnrolled = course?.isEnrolled === true
|
||||
// isEnrolled=true时显示courseAi.png,isEnrolled=false时显示courseAii.png
|
||||
return isEnrolled ? '/images/course/courseAi.png' : '/images/course/courseAii.png'
|
||||
}
|
||||
|
||||
// 数字转中文
|
||||
const numberToChinese = (num: number): string => {
|
||||
const chineseNumbers = ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
|
||||
@ -307,9 +358,10 @@ const loadCourses = async () => {
|
||||
}
|
||||
|
||||
console.log('🔍 查询参数:', queryParams)
|
||||
console.log('🔍 用户登录状态:', userStore.isLoggedIn)
|
||||
|
||||
// 调用API
|
||||
const response = await CourseApi.getCourses(queryParams)
|
||||
// 根据登录状态调用API
|
||||
const response = await CourseApi.getCourses(queryParams, userStore.isLoggedIn)
|
||||
console.log('✅ 课程API响应:', response)
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
@ -919,12 +971,33 @@ onMounted(() => {
|
||||
font-size: 12px;
|
||||
transition: background 0.2s;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.enroll-btn:hover {
|
||||
background: #40a9ff;
|
||||
}
|
||||
|
||||
/* AI伴学按钮样式 */
|
||||
.enroll-btn.ai-btn {
|
||||
background: linear-gradient(135deg, #33C4FF 0%, #0088D1 100%);
|
||||
}
|
||||
|
||||
.enroll-btn.ai-btn:hover {
|
||||
background: linear-gradient(135deg, #2bb3ff 0%, #0077b8 100%);
|
||||
}
|
||||
|
||||
/* 按钮图标样式 */
|
||||
.button-icon {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
object-fit: contain;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px; /* 向下调整图标位置 */
|
||||
}
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
@ -9,12 +9,10 @@
|
||||
<div class="demo-section">
|
||||
<h2>本地视频播放</h2>
|
||||
<div class="video-wrapper">
|
||||
<VideoPlayer
|
||||
:use-local-video="true"
|
||||
<DPlayerVideo
|
||||
video-url="/video/first.mp4"
|
||||
title="本地视频演示"
|
||||
description="这是来自public/video/first.mp4的本地视频文件,使用CKPlayer播放器进行播放。"
|
||||
:autoplay="false"
|
||||
:show-controls="true"
|
||||
@play="onPlay"
|
||||
@pause="onPause"
|
||||
@ended="onEnded"
|
||||
@ -66,7 +64,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import VideoPlayer from '@/components/VideoPlayer.vue'
|
||||
import DPlayerVideo from '@/components/DPlayerVideo.vue'
|
||||
|
||||
|
||||
// 播放状态
|
||||
@ -74,7 +72,7 @@ const isPlaying = ref(false)
|
||||
const errorMessage = ref('')
|
||||
|
||||
// 视频播放器引用
|
||||
const videoPlayerRef = ref<InstanceType<typeof VideoPlayer>>()
|
||||
const videoPlayerRef = ref<InstanceType<typeof DPlayerVideo>>()
|
||||
|
||||
|
||||
|
||||
@ -119,9 +117,8 @@ const seekVideo = (time: number) => {
|
||||
}
|
||||
|
||||
const setVideoVolume = (volume: number) => {
|
||||
if (videoPlayerRef.value) {
|
||||
videoPlayerRef.value.setVolume(volume)
|
||||
}
|
||||
console.log('设置音量:', volume)
|
||||
// DPlayerVideo 组件暂不支持动态设置音量
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<img src="/images/aiCompanion/AI伴学标签@2x.png" alt="AI伴学" class="tag-image"></img><template>
|
||||
<div class="exam-page">
|
||||
<!-- 练习中心标题 -->
|
||||
<div class="banner-section">
|
||||
@ -518,15 +518,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import { CourseApi } from '@/api/modules/course'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const message = useMessage()
|
||||
|
||||
// 路由参数
|
||||
const courseId = ref(Number(route.params.courseId))
|
||||
const sectionId = ref(Number(route.params.sectionId))
|
||||
const courseId = ref(String(route.params.courseId))
|
||||
const sectionId = ref(String(route.params.sectionId))
|
||||
const courseName = ref(route.query.courseName as string || '课程名称')
|
||||
const examName = ref(route.query.examName as string || '练习')
|
||||
const examName = ref(route.query.practiceName as string || '练习')
|
||||
|
||||
// 作业数据加载状态
|
||||
const homeworkLoading = ref(false)
|
||||
const homeworkData = ref<any>(null)
|
||||
|
||||
// 练习状态
|
||||
const examStarted = ref(false)
|
||||
@ -1530,12 +1537,50 @@ onUnmounted(() => {
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// 加载作业数据
|
||||
const loadHomeworkData = async () => {
|
||||
try {
|
||||
homeworkLoading.value = true
|
||||
console.log('🚀 开始加载作业数据,课程ID:', courseId.value, '章节ID:', sectionId.value)
|
||||
|
||||
// 检查是否从路由查询参数中传递了作业数据
|
||||
if (route.query.homeworkData) {
|
||||
try {
|
||||
homeworkData.value = JSON.parse(route.query.homeworkData as string)
|
||||
console.log('✅ 从路由参数获取作业数据:', homeworkData.value)
|
||||
return
|
||||
} catch (e) {
|
||||
console.warn('⚠️ 解析路由参数中的作业数据失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
// 调用API获取作业数据
|
||||
const response = await CourseApi.getSectionHomework(courseId.value, sectionId.value)
|
||||
|
||||
if (response.code === 200 || response.code === 0) {
|
||||
homeworkData.value = response.data
|
||||
console.log('✅ 从API获取作业数据成功:', homeworkData.value)
|
||||
} else {
|
||||
console.error('❌ 获取作业数据失败:', response.message)
|
||||
message.error(response.message || '获取作业数据失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 加载作业数据异常:', error)
|
||||
message.error('加载作业数据失败,请稍后重试')
|
||||
} finally {
|
||||
homeworkLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
console.log('练习页面加载完成')
|
||||
console.log('课程ID:', courseId.value)
|
||||
console.log('章节ID:', sectionId.value)
|
||||
console.log('练习名称:', examName.value)
|
||||
|
||||
// 加载作业数据
|
||||
await loadHomeworkData()
|
||||
|
||||
// 初始化答案数组
|
||||
initializeAnswers()
|
||||
|
||||
|
@ -119,7 +119,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick } from 'vue'
|
||||
import { ref, nextTick, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import { CourseApi } from '@/api/modules/course'
|
||||
import DPlayerVideo from '@/components/course/DPlayerVideo.vue'
|
||||
|
||||
// 视频播放弹窗相关状态
|
||||
|