Skip to content

Commit

Permalink
Merge branch 'release/3.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
stonko1994 committed Jul 17, 2024
2 parents 646fcce + 975b1b8 commit 4b266aa
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion BitmovinConvivaAnalytics.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'BitmovinConvivaAnalytics'
s.version = '3.3.0'
s.version = '3.3.1'
s.summary = 'Conviva Analytics Integration for the Bitmovin Player iOS SDK'

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion BitmovinConvivaAnalytics/Assets/BitmovinConviva-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<string>3.3.1</string>
</dict>
</plist>
7 changes: 6 additions & 1 deletion BitmovinConvivaAnalytics/Classes/ConvivaAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,13 @@ private extension ConvivaAnalytics {
}

setupPlayerStateManager()
updateSession()

videoAnalytics.reportPlaybackRequested(contentMetadataBuilder.build())
logger.debugLog(message: "Creating session with metadata: \(contentMetadataBuilder)")
logger.debugLog(message: "Session started")
isSessionActive = true

updateSession()
}

private func updateSession() {
Expand Down Expand Up @@ -539,6 +540,10 @@ extension ConvivaAnalytics: BitmovinPlayerListenerDelegate {
internalEndSession()
}

func onSourceLoaded() {
updateSession()
}

func onTimeChanged() {
reportPlayHeadTime()
updateSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ extension BitmovinPlayerListener: PlayerListener {
}
}

func onSourceLoaded(_ event: SourceLoadedEvent, player: any Player) {
delegate?.onSourceLoaded()
}

func onTimeChanged(_ event: TimeChangedEvent, player: Player) {
delegate?.onTimeChanged()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Foundation
protocol BitmovinPlayerListenerDelegate: AnyObject {
func onEvent(_ event: Event)
func onSourceUnloaded()
func onSourceLoaded()
func onTimeChanged()
func onPlayerError(_ event: PlayerErrorEvent)
func onSourceError(_ event: SourceErrorEvent)
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [3.3.1] - 2024-07-14

### Fixed
- Missing content length reporting when autoplay is enabled

## [3.3.0] - 2024-07-04

### Added
Expand Down
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PODS:
- BitmovinAnalyticsCollector/Core
- BitmovinPlayerCore (~> 3.48)
- BitmovinAnalyticsCollector/Core (3.7.0)
- BitmovinConvivaAnalytics (3.3.0):
- BitmovinConvivaAnalytics (3.3.1):
- BitmovinPlayer (~> 3.64)
- ConvivaSDK (~> 4.0)
- BitmovinPlayer (3.64.0):
Expand Down Expand Up @@ -58,7 +58,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
BitmovinAnalyticsCollector: bbd82c0b8e11aefacd8e53b6e40c62f2cba6f3f5
BitmovinConvivaAnalytics: 263a2f7aee931eb1aa6274bf997ab7453d580c4a
BitmovinConvivaAnalytics: a289d24fe69d6755a56dcf137096c558ea6dd02b
BitmovinPlayer: f69350e5db2f57ad950108ec829b7c7a4b360d00
BitmovinPlayerCore: 1553570729eed0a64cdfbd06d16c39d69d7e701f
ConvivaSDK: 5d10811e8611ed1fd99a5ab291bdcb1e795f8756
Expand Down
26 changes: 20 additions & 6 deletions Example/Tests/ContentMetadataTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,36 @@ class ContentMetadataTest: QuickSpec {

context("when updating session") {
it("update video duration") {
_ = TestDouble(aClass: playerDouble!, name: "duration", return: 50.0)

playerDouble.fakePlayEvent() // to initialize session
var metadata = MetadataOverrides()
metadata.duration = 50
convivaAnalytics.updateContentMetadata(metadataOverrides: metadata)
let spy = Spy(aClass: CISVideoAnalyticsTestDouble.self, functionName: "setContentInfo")

expect(spy).to(
haveBeenCalled(withArgs: ["duration": "50"])
)
}

describe("when duration is not yet available on play") {
it("update video duration on source loaded") {
_ = TestDouble(aClass: playerDouble!, name: "duration", return: 0.0)
playerDouble.fakePlayEvent() // to initialize session

_ = TestDouble(aClass: playerDouble!, name: "duration", return: 50.0)
playerDouble.fakeSourceLoadedEvent() // to initialize session

let spy = Spy(aClass: CISVideoAnalyticsTestDouble.self, functionName: "setContentInfo")

expect(spy).to(
haveBeenCalled(withArgs: ["duration": "50"])
)
}
}

it("update stream type (VOD/Live)") {
_ = TestDouble(aClass: playerDouble!, name: "isLive", return: true)

playerDouble.fakePlayEvent() // to initialize session
var metadata = MetadataOverrides()
metadata.streamType = StreamType.CONVIVA_STREAM_LIVE
convivaAnalytics.updateContentMetadata(metadataOverrides: metadata)
let spy = Spy(aClass: CISVideoAnalyticsTestDouble.self, functionName: "setContentInfo")

expect(spy).to(
Expand Down
7 changes: 7 additions & 0 deletions Example/Tests/Doubles/BitmovinPlayerTestDouble.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ class BitmovinPlayerTestDouble: BitmovinPlayerStub, TestDoubleDataSource {
onTimeChanged(TimeChangedEvent(currentTime: 1), player)
}

func fakeSourceLoadedEvent() {
guard let onSourceLoaded = fakeListener?.onSourceLoaded else {
return
}
onSourceLoaded(SourceLoadedEvent(source: fakeSource), player)
}

func fakeSourceUnloadedEvent() {
guard let onSourceUnloaded = fakeListener?.onSourceUnloaded else {
return
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BitmovinConvivaAnalytics is available through [CocoaPods](https://cocoapods.org)
To install it, simply add the following line to your Podfile:

```ruby
pod 'BitmovinConvivaAnalytics', git: 'https://github.com/bitmovin/bitmovin-player-ios-analytics-conviva.git', tag: '3.3.0'
pod 'BitmovinConvivaAnalytics', git: 'https://github.com/bitmovin/bitmovin-player-ios-analytics-conviva.git', tag: '3.3.1'
```

Then, in your command line run:
Expand Down

0 comments on commit 4b266aa

Please sign in to comment.