|
33 | 33 | import { VideoFileModel } from '../../models/contribute-resource/blocks/videoFileModel'; |
34 | 34 | import { MKPlayer } from '@mediakind/mkplayer'; |
35 | 35 | import { resourceData } from '../../data/resource'; |
| 36 | + import { MKPlayerType, MKStreamType } from '../../MKPlayerConfigEnum'; |
| 37 | + //import { MKPlayerType } from '@mediakind/mkplayer/types/enums/MKPlayerType.d'; |
| 38 | + //import { MKStreamType } from '@mediakind/mkplayer/types/enums/MKStreamType.d'; |
36 | 39 | export default Vue.extend({ |
37 | 40 | props: { |
38 | 41 | fileId: Number, |
|
52 | 55 | await this.getMKIOPlayerKey(); |
53 | 56 | this.getMediaPlayUrl(); |
54 | 57 | this.load(); |
55 | | - }, |
| 58 | + }, |
56 | 59 | methods: { |
57 | 60 | onPlayerReady() { |
58 | 61 | const videoElement = document.getElementById("bitmovinplayer-video-" + this.getPlayerUniqueId) as HTMLVideoElement; |
|
86 | 89 | getMediaPlayUrl() { |
87 | 90 | this.playBackUrl = this.videoFile.locatorUri; |
88 | 91 | this.playBackUrl = this.playBackUrl.substring(0, this.playBackUrl.lastIndexOf("manifest")) + "manifest(format=m3u8-cmaf,encryption=cbc)"; |
89 | | - // this.playBackUrl = "https://ep-defaultlhdev-mediakind02-dev-by-am-sl.uksouth.streaming.mediakind.com/d01d30e4-461f-4045-bc10-3c88a296f3af/manifest.ism/manifest(format=m3u8-cmaf,encryption=cbc)" |
90 | 92 | }, |
91 | 93 | load() { |
92 | | - // Grab the video container |
93 | | - this.videoContainer = document.getElementById(this.getPlayerUniqueId); |
| 94 | + // Grab the video container |
| 95 | + this.videoContainer = document.getElementById(this.getPlayerUniqueId); |
94 | 96 |
|
95 | | - if(!this.mkioKey) { |
96 | | - this.getMKIOPlayerKey(); |
97 | | - } |
98 | 97 |
|
99 | | - // Prepare the player configuration |
100 | | - const playerConfig = { |
101 | | - key: this.mkioKey, |
102 | | - ui: false, |
103 | | - theme: "dark", |
104 | | - playback: { |
105 | | - muted: false, |
106 | | - autoplay: false, |
107 | | - }, |
108 | | - events: { |
109 | | - //error: this.onPlayerError, |
110 | | - //timechanged: this.onTimeChanged, |
111 | | - //onpause: this.onpause, |
112 | | - //onplay: this.onplay, |
113 | | - //muted: this.onMuted, |
114 | | - //unmuted: this.onUnmuted, |
115 | | - ready: this.onPlayerReady, |
116 | | - subtitleadded: this.onSubtitleAdded, |
| 98 | + if (!this.mkioKey) { |
| 99 | + this.getMKIOPlayerKey(); |
| 100 | + } |
117 | 101 |
|
118 | | - //playbackspeed: this.onPlaybackSpeed |
119 | | - } |
120 | | - }; |
| 102 | + // Prepare the player configuration |
| 103 | + const playerConfig = { |
| 104 | + key: this.mkioKey, |
| 105 | + ui: false, |
| 106 | + theme: "dark", |
| 107 | + playback: { |
| 108 | + muted: false, |
| 109 | + autoplay: false, |
| 110 | + preferredTech: [{ player: MKPlayerType.Html5, streaming: MKStreamType.Hls }] // to force the player to use html5 player instead of native on safari |
| 111 | + }, |
| 112 | + events: { |
| 113 | + //error: this.onPlayerError, |
| 114 | + //timechanged: this.onTimeChanged, |
| 115 | + //onpause: this.onpause, |
| 116 | + //onplay: this.onplay, |
| 117 | + //muted: this.onMuted, |
| 118 | + //unmuted: this.onUnmuted, |
| 119 | + ready: this.onPlayerReady, |
| 120 | + subtitleadded: this.onSubtitleAdded, |
121 | 121 |
|
122 | | - // Initialize the player with video container and player configuration |
123 | | - this.player = new MKPlayer(this.videoContainer, playerConfig); |
| 122 | + //playbackspeed: this.onPlaybackSpeed |
| 123 | + } |
| 124 | + }; |
124 | 125 |
|
125 | | - // ClearKey DRM configuration |
126 | | - var clearKeyConfig = { |
127 | | - //LA_URL: "https://ottapp-appgw-amp.prodc.mkio.tv3cloud.com/drm/clear-key?ownerUid=azuki", |
128 | | - LA_URL:"HLS_AES", |
129 | | - headers: { |
130 | | - "Authorization": this.getBearerToken() |
131 | | - } |
132 | | - }; |
| 126 | + // Initialize the player with video container and player configuration |
| 127 | + this.player = new MKPlayer(this.videoContainer, playerConfig); |
133 | 128 |
|
134 | | - // Load source |
135 | | - const sourceConfig = { |
136 | | - hls: this.playBackUrl, |
137 | | - drm: { |
138 | | - clearkey: clearKeyConfig |
139 | | - } |
140 | | - }; |
| 129 | + // ClearKey DRM configuration |
| 130 | + var clearKeyConfig = { |
| 131 | + //LA_URL: "https://ottapp-appgw-amp.prodc.mkio.tv3cloud.com/drm/clear-key?ownerUid=azuki", |
| 132 | + LA_URL: "HLS_AES", |
| 133 | + headers: { |
| 134 | + "Authorization": this.getBearerToken() |
| 135 | + } |
| 136 | + }; |
141 | 137 |
|
142 | | - this.player.load(sourceConfig) |
143 | | - .then(() => { |
144 | | - console.log("Source loaded successfully!"); |
145 | | - }) |
146 | | - .catch(() => { |
147 | | - console.error("An error occurred while loading the source!"); |
148 | | - }); |
149 | | - } |
| 138 | + // Load source |
| 139 | + const sourceConfig = { |
| 140 | + hls: this.playBackUrl, |
| 141 | + drm: { |
| 142 | + clearkey: clearKeyConfig |
| 143 | + } |
| 144 | + }; |
| 145 | +
|
| 146 | + this.player.load(sourceConfig) |
| 147 | + .then(() => { |
| 148 | + console.log("Source loaded successfully!"); |
| 149 | + }) |
| 150 | + .catch(() => { |
| 151 | + console.error("An error occurred while loading the source!"); |
| 152 | + }); |
| 153 | + } |
150 | 154 | }, |
151 | 155 | computed: { |
152 | 156 | getPlayerUniqueId(): string { |
|
0 commit comments